igraph-help
[Top][All Lists]

## Re: [igraph] biconnected.components vs cohesive.blocks

 From: Gábor Csárdi Subject: Re: [igraph] biconnected.components vs cohesive.blocks Date: Thu, 4 Jul 2013 10:25:03 -0400

Seems to be a cohesive blocking bug, I reported it:

G.

On Thu, Jul 4, 2013 at 9:44 AM, Massimo Franceschet wrote:
[Using igraph ‘0.6.5.1’ under R]

I noticed that cohesive blocks (with cohesion equal to 2) and biconnected components of a graph might differ (to my knowledge, they should be the same). Here's an example:

# Load Newman's network science collaboration graph
# (http://www-personal.umich.edu/~mejn/netdata/netscience.zip)

# Get the giant component of the graph
cl = clusters(g)
g = induced.subgraph(g, which(cl\$membership == which.max(cl\$csize)))

# Get cohesive blocks
cb = cohesive.blocks(g)
b = blocks(cb)

# Get the largest cohesive block with cohesion 2 (number 69, should be the largest biconnected component)
g1 = induced.subgraph(g, b[[69]])

# Get biconnected components
bc = biconnected.components(g)
c = bc\$components
# Get the largest biconnected component (number 86)
g2 = induced.subgraph(g, c[[86]])

> graph.cohesion(g1)
[1] 2

> graph.cohesion(g2)
[1] 2

Now, g1 and g2 should be the same graph, but:

> g1
IGRAPH U--- 56 171 --
+ attr: id (v/n), label (v/c), value (e/n)

> g2
IGRAPH U--- 134 372 --
+ attr: id (v/n), label (v/c), value (e/n)

Thanks,

Massimo Franceschet
_______________________________________________
igraph-help mailing list