Number of elements in a intersection graph
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. Best regards! Thanks a lot. José Luis
On Wed, Jul 9, 2014 at 1:29 AM, Josè Luis Mietta <joseluismietta@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... You can make a networkx.Graph object from your adjacency matrix very simply: graph = networkx.Graph(M) -- Robert Kern
Use NetworkX + breadth first search and you are done. On Wed, Jul 9, 2014 at 12:31 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Wed, Jul 9, 2014 at 1:29 AM, Josè Luis Mietta <joseluismietta@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...
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@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Josè Luis Mietta -
Robert Kern -
Ted Sandler