igraph-help
[Top][All Lists]

Re: [igraph] Igraph calculating minimum spanning tree with weights C int

 From: Tamas Nepusz Subject: Re: [igraph] Igraph calculating minimum spanning tree with weights C interface Date: Wed, 30 Mar 2016 11:19:04 +0200

```Hi Dave,

In igraph, each edge has an integer identifier from zero to |E|-1
(where |E| is the number of edges). Typically, the identifiers
represent the order in which the edges were added to the graph. The
weight vector that you should supply to the Prim algorithm should also
be of length |E|, and its i-th element should contain the weight of
the edge with index i.

I hope this clarifies things. Let me know if you need more details.

All the best,
T.

On Tue, Mar 29, 2016 at 6:11 PM,  <address@hidden> wrote:
> Thanks Tempas for answering that question.
>
> Its not very clear from the description in the source documentation about how
> to set up the weighting which is why I wrote the program.
>
> So if N link from X to Y  then the N entry in the weights vector is the
> weight to to use?
>
> I will update my code,  a writing  a back end function for the pgrouting
> codebase for some network working I am doing.
>
> Dave.
>
> 29 March 2016 15:54, "Tamas Nepusz" <address@hidden> wrote:
>> Hi,
>>
>>> I have been trying to calculate a minimum spanning tree using prim method,
>>> but I have got a little bit confused about the weights are used in this
>>> context. The suggest example program in the source documents does not seem
>>> to be correct, I don't understand why the edge betweenness needs to be
>>> calculated.
>>
>> They don't have to - we just needed _some_ kind of weights in the
>> example (because the Prim algorithm works with weighted graphs), so we
>> decided to use the edge betweenness scores of the edges as the
>> weights. If you have built your own vector, there is no need for the
>> call to igraph_edge_betwenness().
>>
>> T.
>>
>> _______________________________________________
>> igraph-help mailing list