Ask Your Question
-1

NetworkX - create a Graph

asked 2013-09-05 13:11:59 -0500

mresimulator gravatar image

updated 2016-06-07 13:58:59 -0500

FrédéricC gravatar image

Hi experts!

I wanna use

networkx.has_path(G)

where G is the graph associated to de adjacency matrix M (a N x N numpy array) of a undirected graph.

How can I create a networkx graph (necesary for use networkx.has_path()) from M?

Thanks a lot!

edit retag flag offensive close merge delete

Comments

1

You should probably use Sage objects directly (i.e. a `matrix` instead of a numpy array, and a `Graph` instead of a NetworkX object), since there are better interfaced to eachother, and you will not have to rewrite everything.

tmonteil gravatar imagetmonteil ( 2013-09-06 03:43:44 -0500 )edit

1 answer

Sort by » oldest newest most voted
-2

answered 2013-09-06 09:03:31 -0500

mresimulator gravatar image

A networkx graph is necesary for use networkx.has_path().

So, how can I generate this networkx graph from a python matrix or numpy matrix?

Thanks

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-09-05 13:11:59 -0500

Seen: 151 times

Last updated: Sep 06 '13