Ask Your Question
1

convert from networkx to sage

asked 2016-07-19 14:17:17 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

plz hep i am new user in sage,,, how to i use one networkx function in sage

from networkx import algebraic_connectivity as AlgebraicConnectivity........? AlgebraicConnectivity(sage.Graph)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-07-21 06:42:04 -0500

tmonteil gravatar image

If G is your Sage graph, you can turn it into a networkx graph with the networkx_graph as in the following example:

sage: from networkx import algebraic_connectivity as AlgebraicConnectivity

sage: G = graphs.PetersenGraph()
sage: H = G.networkx_graph()
sage: AlgebraicConnectivity(H)
1.9999999999999993

sage: G = graphs.CompleteGraph(12)
sage: H = G.networkx_graph()
sage: AlgebraicConnectivity(H)
11.999999999999998
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: 2016-07-19 14:17:17 -0500

Seen: 49 times

Last updated: Jul 21 '16