[Top][All Lists]

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

Re: [igraph] Collapsing/Folding graph based on vertex attributes

From: Tamás Nepusz
Subject: Re: [igraph] Collapsing/Folding graph based on vertex attributes
Date: Tue, 11 Sep 2012 16:05:16 +0200


Use the contract.vertices() function first to contract the vertices, then use 
simplify() to collapse multiple edges between the now-contracted vertices into 
a single one. These functions let you specify what to do with the attributes of 
the original vertices and edges. For instance, if you want the new (contracted) 
vertices to have a "count" attribute that contains the number of vertices they 
were contracted from, this can be achieved by adding a "count" attribute to 
every vertex of the original graph with a value of 1 and then use 
vertex.attr.comb=list(count="sum") to specify that you want to sum the "count" 
attributes while collapsing. Similarly, you can assign a "weight" of 1 to every 
edge before calling simplify() and then sum the weight of the collapsed edges. 


On Tuesday, 11 September 2012 at 15:58, S. M. Ali Abbas wrote:

> Hi folks,
> I have got a graph with this detail:
> > summary(g)
> IGRAPH UN-- 7690383 7839216 -- 
> attr: Ethnic.Group(v/c), Geographical.Area (v/c), Religion (v/c), 
> Major.Language (v/c)
> I'd like to collapse/reduce my graph to a new graph, where the vertices are 
> grouped together according to their Ethnic.Group attribute, for instance, and 
> then visualize the edges between them. As an example, all vertices with a 
> certain ethnicity, X, should be grouped together (the size of the new vertex 
> should correspond to the number of vertices with X as their ethnicity), and 
> the edge would also be weighted (the number of links between ethnicity X and 
> Y).
> For visualization of the whole graph, I used Gephi which supports grouping of 
> vertices, but unfortunately my system can't handle such a big graph - of 1G 
> size. I'd like to reduce the graph using igraph, and then export it to Gephi 
> for visualization.
> Thanks!
> Cheers,
> Ali
> _______________________________________________
> igraph-help mailing list
> address@hidden (mailto:address@hidden)
> https://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

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