[SciPy-User] cs_graph_componets returning wrong results?

Joohwi Lee telnet2@gmail....
Tue Jan 10 22:46:07 CST 2012


Hi All,

To identify connected components of a graph, I am trying to use
'scipy.sparse.cs_graph_components()' function.

The adjacency graph looks like
array([[1, 0, 0, 0, 1],
       [0, 1, 1, 1, 1],
       [0, 0, 1, 1, 1],
       [0, 0, 0, 1, 1],
       [0, 0, 0, 0, 1]])

The graph is actually consisting of (1 -> (5 = 2 = 3 = 4) ), where
(2,3,4,5) are connected each other and 1 is only connected to 5.

I expect cs_graph_components(x) should return (1, [0,0,0,0,0]) which means
that there is only one component, but it returns (2, array([0, 1, 1, 1, 0],
dtype=int32)).
(1-5) & (2-3-4).

Is this correct result?


- joohwi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120110/ba5b3835/attachment.html 


More information about the SciPy-User mailing list