igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] computing community attributes


From: Tamás Nepusz
Subject: Re: [igraph] computing community attributes
Date: Sat, 18 Aug 2012 21:48:23 +0200

> now, does a community "know" which graph it is coming from?
> (i.e., is there a way to extract "g" from "community.ml"?)
> apparently not, but I wonder why.

The community classes do not store the graph they are coming from. Gabor is the 
developer of the R interface so he can tell you more about this design decision 
(I don't know the reason), but it is relatively easy to attach the graph to the 
communities. E.g.:

library(igraph)
g <- grg.game(100, 0.2)
community.ml <- multilevel.community(g)
community.ml$graph <- g

community.ml$graph will then give you the graph even if you have assigned g to 
something else in the meanwhile.

I think one argument against storing the graph itself in the community 
structure is that community.ml would keep g "alive" in this case even if you 
wanted to get rid of g by reassigning g to something else. For example:

g <- very.large.graph.from.somewhere
community.ml <- multilevel.community(g)
community.ml$graph <- g
g <- very.small.graph

In this case, the original large graph is still in the memory.

Best,
Tamas




reply via email to

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