[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [igraph] igraph.community_fastgreedy method and isolated vertices
From: |
venura.2.mendis |
Subject: |
RE: [igraph] igraph.community_fastgreedy method and isolated vertices |
Date: |
Fri, 8 Aug 2008 10:21:12 +0100 |
Thanks for the help Tamas. When you mentioned non-simple graphs I
realised that I had multiple edges (That I didn't want) in my graph
everything worked fine even with the isolated nodes after I removed
them. If its helpful to have a graph with multiple edges I can send you
the data (let me know what format is best), however everything worked
fine for me once I fixed the bugs in my code.
Thanks,
Venura
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of Tamas Nepusz
Sent: 07 August 2008 15:47
To: Help for igraph users
Subject: Re: [igraph] igraph.community_fastgreedy method and isolated
vertices
Hi,
> its falling over. I suspect its because of isolated vertices (not
> connected to any other nodes) in my graph.
Graph.community_fastgreedy used to fail when executed on non-simple
graphs or graphs with isolated vertices. Theoretically this bug is
corrected in the dev tree (and will be corrected in the upcoming
0.5.1). Anyway, if you could send me an example graph so I could test
it in the dev tree, that would be great.
> I tried to remove them using the following code
Try this:
isolates = g.vs.select(_degree=0)
g.delete_vertices(isolates)
Your code didn't work because igraph reindexes the vertices when you
delete one. Alternatively, you can collect isolate vertex indices
first and delete them in one step:
isolates = [index for index, degree in enumerate(g.degree()) if degree
== 0]
g.delete_vertices(isolates)
--
T.
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help