I'm working in C with igraph library.
I need to calculate the the minimum spanning tree of a graph, using the following call:
igraph_minimum_spanning_tree_prim( &input_graph, &mst_tree, &w);
where:
as is requested in the igraph library, the association between edges and weigths is given by their index, that is, the first edge in the input_graph has a weight given by the first element of w vector, the weight of the second edge is given by the second element of w vector, and so on.
Since the edges of mst_tree are a subset of the edges of input_graph ( consequently, the amount of edges in input_graph and in mst_tree are differents), is not possible get the edges weight of mst_tree, by associating their index.
There is some igraph function to get the weight of each edges in mst_tree, only knowing mst_tree, input_graph and w?
Guillermo.
In igraph 0.5.4, there is no such function, sorry :( In igraph 0.6 the minimum spanning tree API will change a bit so there will be another function with the following signature:
int igraph_minimum_spanning_tree(const igraph_t* graph, igraph_vector_t* res, const igraph_vector_t* weights);
where res
will contain the indices of the edges that constitute the spanning tree. igraph 0.6 is not released yet but it's pretty stable, so you might want to try and upgrade to igraph 0.6 (if you don't mind a few API changes here and there).
Disclaimer: I am one of the authors of igraph.