[Top][All Lists]

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

RE: [igraph] q values from community_fastgreedy() method

From: venura.2.mendis
Subject: RE: [igraph] q values from community_fastgreedy() method
Date: Tue, 22 Jul 2008 15:15:59 +0100

Thanks Tamas, that's exactly what I was after. Your actually helping me
with my understanding of python also!

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of Tamas Nepusz
Sent: 22 July 2008 10:17
To: Help for igraph users
Subject: Re: [igraph] q values from community_fastgreedy() method

Hi Venura,

> This method only appears to return the final q value. The class  
> GaphBase
> appears to have exactly what Im after in the method
> (community_fastgreedy(weights=None, return_q=True)- according to the
> docs this returns a tuple of merges and Q values. However the
> documentation suggests I should use only the method from Graph and as
> far as I can tell this doesn't retrun q values of each merge.
Just to clarify things a little bit:

1. GraphBase is a low-level wrapper around igraph graph objects.  
That's why the documentation suggests that you should not use its  
functionality -- everything that the GraphBase class provides is also  
provided by the Graph class. In fact, the Graph class is directly  
derived from GraphBase via object inheritance, and some of its methods  
are overridden to provide a more convenient interface. (E.g., the  
layout methods in GraphBase return a list of lists (the coordinates),  
while the same methods in Graph return Layout objects instead, which  
are easier to use). Due to inheritance, every Graph object you create  
is also a GraphBase object, so you don't have to create GraphBase  
object separately.

2. All Graph methods call GraphBase methods behind the scenes. In case  
of the community_fastgreedy method, it calls  
GraphBase.community_fastgreedy with the original graph object, then  
wraps the result in a VertexDendrogram object.

Now, suppose you create a Graph somehow, e.g.:

from igraph import *
g = Graph.Barabasi(1000)

If you call the community_fastgreedy method of this object using the  
usual way, you get a VertexDendrogram:

cl = g.community_fastgreedy()

However, you can call the community_fastgreedy method of this object  
as if it were a GraphBase object using the following (pretty weird)  

result = core.GraphBase.community_fastgreedy(g)

Now you get a 2-tuple as the result: the first element is a list of  
merges, the second is the list of modularities.

I hope this is what you wanted.


igraph-help mailing list

reply via email to

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