Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It sounds like you may find

sage: Graph?

very helpful. There is ample documentation there about how to input graphs (say, as dictionaries or incidence matrices).

Once you have created your graph (or DiGraph) you can then plot it.

sage: G = graphs.PetersenGraph()
sage: G.plot?

will give lots of information about every manner of plotting option, including setting the exact locations of each vertex. For even better plot options, if you have LaTeX and tikz, you can look at

sage: sage.graphs.graph_latex.GraphLatex.set_option?

which has more information than I really want, because I don't plot graphs that often.

Hope this helps... I'm not answering the part about adding objects, note, but a list comprehension could be useful.