# Revision history [back]

You can do this using RecursivelyEnumeratedSet. Here is one easy example :

sage: def f(a):
....:     return [2*a, 2*a+1]
sage: R = RecursivelyEnumeratedSet(, f)
sage: G = R.to_digraph(max_depth=4)
sage: G
Looped multi-digraph on 32 vertices


Using optional package slabbe (installed with sage -pip install slabbe), you may draw the graph (this requires graphviz and dot2tex installed):

sage: from slabbe import TikzPicture
sage: tikz = TikzPicture.from_graph(G)
sage: tikz.pdf()


You can do this using RecursivelyEnumeratedSet. Here is one easy example :

sage: def f(a):
....:     return [2*a, 2*a+1]
sage: R = RecursivelyEnumeratedSet(, RecursivelyEnumeratedSet(, f)
sage: G = R.to_digraph(max_depth=4)
sage: G
Looped multi-digraph on 32 63 vertices


Using optional package slabbe (installed with sage -pip install slabbe), you may draw the graph (this requires graphviz and dot2tex installed):

sage: from slabbe import TikzPicture
sage: tikz = TikzPicture.from_graph(G)
sage: tikz.pdf()


You can do this using RecursivelyEnumeratedSet. Here is one easy example :

sage: def f(a):
....:     return [2*a, 2*a+1]
sage: R = RecursivelyEnumeratedSet(, f)
sage: R
A recursively enumerated set (breadth first search)
sage: G = R.to_digraph(max_depth=4)
sage: G
Looped multi-digraph on 63 vertices


Using optional package slabbe (installed with sage -pip install slabbe), you may draw the graph (this requires graphviz and dot2tex installed):

sage: from slabbe import TikzPicture
sage: tikz = TikzPicture.from_graph(G)
sage: tikz.pdf()


You can do this using RecursivelyEnumeratedSet. Here is one easy example :

sage: def f(a):
....:     return [2*a, 2*a+1]
sage: R = RecursivelyEnumeratedSet(, f)
sage: R
A recursively enumerated set (breadth first search)
sage: G = R.to_digraph(max_depth=4)
sage: G
Looped multi-digraph on 63 vertices
sage: view(G)


Using optional package slabbe (installed with sage -pip install slabbe), ) + graphviz + dot2tex, you may draw the graph (this requires graphviz and dot2tex installed):a nicer looking graph:

sage: from slabbe import TikzPicture
sage: tikz = TikzPicture.from_graph(G)
sage: tikz.pdf()