[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] on VertexClustering
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] on VertexClustering |
Date: |
Thu, 22 Dec 2011 19:22:39 +0100 |
Hello,
> I'm trying to get some graph clustering done, so I create a graph from
> my graphml and try to run VertexClustering.
VertexClustering is just a data structure, not a particular clustering
algorithm. VertexClustering instances are returned by several graph clustering
methods, but they are all implemented as methods of the Graph class. Look for
methods starting with "community_" in the Graph class to get a rough idea of
the available algorithms.
E.g.:
>>> g = igraph.Graph.Read_GraphML("myfile.xml")
>>> cl = g.community_fastgreedy()
>>> print type(cl)
igraph.clustering.VertexClustering
>>> print cl.membership
Some clustering algorithms return a VertexDendrogram instead of a
VertexClustering, but since VertexDendrogram is derived from VertexClustering
in igraph 0.5, you can still use its "membership" property.
By the way, if you want to construct a VertexClustering by hand, you need two
arguments: the first argument specifies the graph, the second argument is the
membership vector (i.e. the cluster index for each vertex).
Cheers,
T.