igraph-help
[Top][All Lists]

## Re: [igraph] Running time

 From: Tamas Nepusz Subject: Re: [igraph] Running time Date: Fri, 30 Jul 2010 18:35:08 +0100

```Dear Albert,

fastgreedy.community() returns a dendrogram, not a membership vector like
spinglass.community, so com\$membership is NULL, that's why the code does not
work for you. After executing fastgreedy.community, the result will have two
parts: com\$merges is a merge matrix that encodes the dendrogram and
com\$modularity stores the modularity scores after each merge. First, you have
to figure out where the maximal modularity is reached
(which.max(com\$modularity)) and pass that to community.to.membership to perform
the merges in the dendrogram and obtain the membership vector. See the
following wiki page for examples:

http://igraph.wikidot.com/community-detection-in-r#toc3

--
Tamas

On 2010.07.30., at 18:09, Soós Albert wrote:

> Hello!
>
> Thanks for the fast reply. I have another question, how can i draw the result
> of a clustering? I found an example int he tutorial:
> g <- graph.full(5) %du% graph.full(5) %du% graph.full(5)
> g <- add.edges(g, c(0,5, 0,10, 5,10))
> com <- spinglass.community(g, spins=5)
> V(g)\$color <- com\$membership+1
> g <- set.graph.attribute(g, "layout", layout.kamada.kawai(g))
> plot(g, vertex.label.dist=1.5)
>
> I read my input graphs, and i use the fastgreedy or the edge betweenness
> algorithm so i modified the code:
>
> com <- fastgreedy.community(graph, merges=TRUE, modularity=TRUE, weights=NULL)
> V(graph)\$color <- com\$membership+1
> graph <- set.graph.attribute(graph, "layout", layout.kamada.kawai(graph))
> plot(graph, vertex.label.dist=1.5)
> It draws the graph with the given layout, but it doesn’t color the
> communities.
>
> Albert
>
>
>
> -- Eredeti üzenet --
> Címzett: Help for igraph users <address@hidden>
> Elküldve: 2010. július 30. 14:21
> Tárgy : Re: [igraph] Running time
>
>
> Hi Albert,
>
> > Hello! If i run a clustering algorithm in R, how can i get the
> > running time?
> Use system.time, e.g.:
>
> > system.time(fastgreedy.community(graph))
>
>
> > I tried to run the CNM algorithm, and i got this error message: At
> > fast_community.c:525 : fast greedy community detection works for
> > undirected graphs only, Unimplemented function
> As the message says above, this algorithm works for undirected graphs
> only, and your graph is directed. Please convert it to an undirected one
> first using to.undirected(). If you load your graph from an external
> file, the loader function might also have a directed=... parameter where
> you can explicitly specify that you want the graph to be undirected.
> (This works only for formats such as edgelist, NCOL and LGL where the
> file itself does not contain whether the graph is directed or
> undirected).
>
> --
> Tamas
>
> _______________________________________________
> igraph-help mailing list
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
> --------------------------Hirdetés-----------------------------
>
> Török tengerpart. Böngésszen a C-Travel ajánlatai között!
> _______________________________________________
> igraph-help mailing list