Ask Your Question
-1

NetworkX - create a Graph

asked 2013-09-05 20:11:59 +0200

mresimulator gravatar image

updated 2016-06-07 20:58:59 +0200

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 10:43:44 +0200 )edit

For the record, a Sage graph has a method that returns the corresponding NetworkX graph.

Hugh Thomas gravatar imageHugh Thomas ( 2017-09-18 23:28:47 +0200 )edit

1 Answer

Sort by » oldest newest most voted
-2

answered 2013-09-06 16:03:31 +0200

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 20:11:59 +0200

Seen: 434 times

Last updated: Sep 06 '13