igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] i can't find it, but there must be an easy was to reduce a


From: Yannick Rochat
Subject: Re: [igraph] i can't find it, but there must be an easy was to reduce a graph
Date: Sun, 7 Mar 2010 23:51:00 +0100

Harun,

Thank you for your answer.

What I call "reduced graph" in this context is a graph g' whose nodes are the communities of g and an edge exist between two nodes of g' if there is at least one edge between the two correspondent communities. For example, this graph is made of three easy to observe cliques :

g <- add.edges(graph.disjoint.union(graph.full(5),graph.full(6),graph.full(7)),c(4,5,10,11))

I want graph.full(5) to be node 0, graph.full(6) to be node 1 and graph.full(7) to be node 2. Then the reduced graph consists of those 3 nodes, and edges 0 -- 1 and 1 -- 2, but not the 3rd edge because the two others communities weren't adjacent.

subgraph(g, V(g)[clust==i]) will substract the community from the graph but keep it untouched.

Best,


Yannick



---------------------------------------------------------------
Yannick Rochat - IMA - Université de Lausanne
http://www.unil.ch/unisciences/YannickRochat


2010/3/6 harun pirim <address@hidden>
On 3/6/10 4:58 AM, Yannick Rochat wrote:
Hello,

>From a graph g, I'd like to create the reduced graph whom nodes are the communities of g and edges are induced by those of g. I don't see an easy way to do this (the complicated ways, I see a lot of them). Is there are function in igraph that can reduce a graph ?

I think you can use subgraph(g, V(g)[clust==i]) where clust holds members of communities. This gives you subgraphs using the edges of g and community vertices. Then I think(I didn't try) you can use disjoint union function to merge all the subgraphs, then you end up with induced graphh?
Hope this works

Harun
Thanks !

Yannick


reply via email to

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