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

Ted Sandler ted.sandler at gmail.com
Wed Jul 9 20:29:04 EDT 2014


Use NetworkX + breadth first search and you are done.



On Wed, Jul 9, 2014 at 12:31 PM, Robert Kern <robert.kern at gmail.com> wrote:

> 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
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140709/784e8df4/attachment.html>


More information about the NumPy-Discussion mailing list