[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Help with Weighted_Adjacency

From: Tamás Nepusz
Subject: Re: [igraph] Help with Weighted_Adjacency
Date: Wed, 25 Jun 2014 15:34:41 +0200

> graph3 = Graph.Weighted_Adjacency(AdjacencyMatrix3, mode = 'directed', attr = 
> 'weight')
> evcentr3 = Graph.evcent(graph3)  

You need to specify that evcent() should use the weights coming from the 
"weight" attribute; see help(Graph.evcent)

@param weights: edge weights given as a list or an edge attribute. If
      C{None}, all edges have equal weight.

So you need this:

evcentr3 = graph3.evcent(weights=graph3.es["weight"])

The same applies for pagerank() and betweenness(). However, note that the 
semantics of weights is different for the betweenness centrality; for PageRank 
and eigenvector centrality, a larger weight means a closer association between 
the endpoints, while this is exactly the opposite for betweenness() since it 
works with _shortest_ paths.

> I am using python and have aldo had problems with the following commands:
> graph3.is_weighted
> AttributeError: 'Graph' object has no attribute 'is_weighted'
is_weighted() is not an attribute but a method:


> g = Graph.Adjacency(AdjacencyMatrix3, weighted = True)
> TypeError: 'weighted' is an invalid keyword argument for this function
Adjacency() does not have a keyword argument named "weighted"; see 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]