igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] python-igraph get the largest component in a indirect netwo


From: Tamas Nepusz
Subject: Re: [igraph] python-igraph get the largest component in a indirect network
Date: Thu, 16 Oct 2014 23:55:29 +0200

> I am working on a protein-protein interaction network using python-igraph
> and I want get the largest component in it and get the protein list (by
> their names) in the largest component. But after I call the ".clusters()", I
> am not sure what to do next.
.clusters() gives you a VertexClustering object:

https://pythonhosted.org/python-igraph/igraph.clustering.VertexClustering-class.html

You can call its .giant() method to get the largest component and then you can 
simply retrieve the vertex names from there:

cl = g.clusters()
largest_component = g.giant()
print largest_component.vs[“name”]

(This assumes that the protein names are stored in a vertex attribute named 
“name”)

Best,
T.



reply via email to

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