Ask Your Question

Graph plotting in SMC

asked 2014-09-28 07:41:29 +0200

Han gravatar image

updated 2014-09-28 17:53:16 +0200

I was trying to plot some graphs in SMC. However, even the first example given in Graph Plotting doesn't work. I only got an empty output. The following is the example i was trying.

sage: G = graphs.WheelGraph(15)

sage: G.plot()

What am I missing in my example?

P.S.: Yes. The example works in Sage worksheets, however, it doesn't work in iPython notebook. How to make it work in iPython notebook?

edit retag flag offensive close merge delete


Nothing missing; the code works in a [Sage Cell Server](

dazedANDconfused gravatar imagedazedANDconfused ( 2014-09-28 16:17:26 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-29 01:25:31 +0200

calc314 gravatar image

Try the following code in ipython in SMC to load the sage commands and the networkx library. Then, you can see the graph.

from sage.all import *
import networkx as nx
G = graphs.WheelGraph(15)
edit flag offensive delete link more


I'm afraid the code cannot return what I expected. Yes, it returns a Wheel graph with 15 vertices. But the graph drawn there is ugly. Thank you for sharing anyway.

Han gravatar imageHan ( 2014-09-29 17:27:03 +0200 )edit

I get the same graph in iPython as in Sage. There are some formatting options for graphs that can be used in Sage. I imagine that networkx has similar options that might allow you to get the format that you want.

calc314 gravatar imagecalc314 ( 2014-10-01 14:34:30 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2014-09-28 07:41:29 +0200

Seen: 442 times

Last updated: Sep 29 '14