[Numpy-discussion] Number of elements in a intersection graph

Robert Kern robert.kern at gmail.com
Wed Jul 9 15:31:35 EDT 2014


On Wed, Jul 9, 2014 at 1:29 AM, Josè Luis Mietta
<joseluismietta at yahoo.com.ar> wrote:
> Hi experts!!
>
> I am studying the intersection between line segments (sticks). I have an
> Numpy array (M) corresponding to the intersection graph of the system (the
> element Mij = 1 if the sticks' i 'and' 'j' intersect, and Mij = 0 if not
> intersect).
>
> I want to determine the number of elements that form the path that connects
> two sticks (N and K), i.e.: the number of sticks that form the spanning
> cluster between stick N and K.
> How I can do?? Please explain step by step.

The last time you asked a question about this project, we pointed you
to the networkx package.

http://networkx.github.io/documentation/latest/reference/algorithms.shortest_paths.html

You can make a networkx.Graph object from your adjacency matrix very simply:

  graph = networkx.Graph(M)

-- 
Robert Kern



More information about the NumPy-Discussion mailing list