Ask Your Question

Output of plantri and graphs.planar_graphs

asked 2018-05-25 16:08:27 -0500

standardtrickyness gravatar image

updated 2018-06-05 23:38:35 -0500

slelievre gravatar image

I find the documentation of Sage much lacking what is the output of plantri and graphs.planar_graphs?

I assumed the output would be graphs (could not find documentation on this) and did the following

l = graphs.planar_graphs(4, dual=False)    
gen = list(l)       
ii = 1
G = gen[ii] 
p = G.plot()
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2018-06-05 15:35:38 -0500

Sébastien gravatar image

To get the documentation on the function you mention, you do:

sage: graphs.planar_graphs?

which gives:


   An iterator over connected planar graphs using the plantri

   This uses the plantri generator (see [plantri]) which is available
   through the optional package plantri.

   Note: The non-3-connected graphs will be returned several times,
     with all its possible embeddings.


You may also read the documentation of planar_graphs function online.

The output is not a graph, neither a list. It is an iterator of graphs.

edit flag offensive delete link more


To learn more about iterators, you can go through the tutorial at

slelievre gravatar imageslelievre ( 2018-06-05 23:41:36 -0500 )edit

Note about getting to know more about any function, method or module in Sage:

  • graphs.planar_graphs? gives the documentation of graphs.planar_graphs
  • help(graphs.planar_graphs) does the same
  • graphs.planar_graphs?? gives the source code
  • browse_sage_doc(graphs.planar_graphs) gives the documentation in html
  • search_src('graphs.planar_graphs') looks for all occurrences in Sage's source code
  • search_doc('graphs.planar_graphs') looks for all occurrences in Sage's documentation

For Python built-ins, such as for, while, if, use python_help, as in

slelievre gravatar imageslelievre ( 2018-06-05 23:49:36 -0500 )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: 2018-05-25 16:08:27 -0500

Seen: 35 times

Last updated: Jun 05