user3403882
user3403882

Reputation:

python-igraph accessing a specific vertex of a graph

I have created a graph using python-igraph (using python 3.4) and I am trying to access a specific node outdegree using the following line of code:

graph.vertex(i).out_degree()

I have found this code on stackoverflow and I was hoping that this is going to work but I keep receiving an error:

AttributeError: 'Graph' object has no attribute 'vertex'

I would really appreciate your help.

Thanks

Upvotes: 1

Views: 416

Answers (1)

ahajib
ahajib

Reputation: 13520

Not that you are using python 3.4, so probably you need to use the following:

graph.vs[i].outdegree()

And that's how you access node i from your graph. I also mentioned the new method to get the outdegree.

Upvotes: 2

Related Questions