[Top][All Lists]

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

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:


On Thu, Jul 4, 2013 at 9:44 AM, Massimo Franceschet <address@hidden> wrote:
[Using igraph ‘’ 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)
g = read.graph(file="netscience.gml", format="gml")

# 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)


Massimo Franceschet
igraph-help mailing list

reply via email to

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