igraph-help
[Top][All Lists]
Advanced

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

[igraph] Re: igraph-help Digest, Vol 14, Issue 7


From: Simone Caschili
Subject: [igraph] Re: igraph-help Digest, Vol 14, Issue 7
Date: Thu, 13 Sep 2007 16:35:43 +0200

Thank you for your answer!

that's a really good news that you have implemented part of it yet !

Reading the on-line documentation I have got a newbie question:  I'm trying to get how I can create a new network from one stored in a .txt file.

Perhaps in Networkx package (I'm sure you know it), I do it:

>G=Graph()
>#I open the file in order to read it
>while there_is_data:
>     G.add_edge(node1,node2,weight)

How can I do it (or something like it) using igraph package?

Thank you for helping me!

Regards
SC

2007/9/12, address@hidden < address@hidden>:
Send igraph-help mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.nongnu.org/mailman/listinfo/igraph-help
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of igraph-help digest..."


Today's Topics:

   1. community detection analysis using python (Simone Caschili)
   2. Re: community detection analysis using python (Tamas Nepusz)


----------------------------------------------------------------------

Message: 1
Date: Wed, 12 Sep 2007 16:32:13 +0200
From: "Simone Caschili" <address@hidden>
Subject: [igraph] community detection analysis using python
To: address@hidden
Message-ID:
        <address@hidden >
Content-Type: text/plain; charset="iso-8859-1"

Hello All!

It's the first time I'm using igraph library and I have some doubts.
I'd like to use igraph for implementing a community detection analysis but
unfortunately I'm not able to program in C but I usually do it in Python.
I was wondering if the analysis detection is also implemented in the python
igraph version because from the documentation it looks like it doesn't.


Regards,

Simone C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnu.org/pipermail/igraph-help/attachments/20070912/fef40d2f/attachment.html

------------------------------

Message: 2
Date: Wed, 12 Sep 2007 16:46:52 +0200
From: "Tamas Nepusz" < address@hidden>
Subject: Re: [igraph] community detection analysis using python
To: "Help for igraph users" <address@hidden >
Message-ID:
        <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1

Dear Simone,

> I was wondering if the analysis detection is also implemented in the python
> igraph version because from the documentation it looks like it doesn't.
Yes, it's implemented, but it might be a little bit flaky. The
following methods of the Graph object apply to you:

Graph.community_edge_betweenness() - Girvan-Newman hierarchical method
Graph.community_fastgreedy() - Clauset-Newman-Moore hierarchical
method (a.k.a. fast greedy modularity optimization)
Graph.community_leading_eigenvector() - Newman's leading eigenvector method

The C core of igraph also features some other methods (like the
walktrap community detection or the spinglass clustering of Reichardt
& Bornholdt), but these don't have a Python interface (yet). The
reason why they are not included in the online documentation is that I
forgot to update it :) So thanks for pointing that out, the Python
documentation will soon be regenerated and updated!

A small example:

>> g=Graph.GRG(100, 0.2)
>> cl=g.community_fastgreedy()
>> print cl.membership
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
2, 2, 3, 1, 1, 3, 2, 3, 3, 2, 2, 1, 2, 2, 1, 2, 2, 3, 2, 2, 3, 2, 3,
2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 2, 3, 2, 2]

One last note: the leading eigenvector and the edge betweenness
methods are a bit slower than the fast greedy optimization. This is
because the VertexDendrogram objects returned by these methods
calculate the modularity of the resulting partitions at all levels of
the dendrogram in order to select the best split that is returned
afterwards by the membership attribute of the VertexDendrogram object.
The modularity calculation can be speeded up a lot, but I did not have
time to do that yet. This problem does not arise with the
Clauset-Newman-Moore method, because that one calculates the
modularities on the fly. If you want to use the edge betweenness
method or the leading eigenvector method, a workaround for this
problem is to call their low-level equivalents in the GraphBase class,
this will not calculate the modularities. Example:

>> g=Graph.GRG(100, 0.2)
>> merges=GraphBase.community_edge_betweenness (g)

The result is the same merge matrix that's returned by the C interface
(see the documentation of the C interface about how to interpret
that).

Best regards,
--
Tamas




------------------------------

_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help


End of igraph-help Digest, Vol 14, Issue 7
******************************************


reply via email to

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