igraph-help
[Top][All Lists]

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

 From: Massimo Franceschet Subject: [igraph] biconnected.components vs cohesive.blocks Date: Thu, 4 Jul 2013 15:44:14 +0200

```[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

```