Ask Your Question

Revision history [back]

For the first question, you can use the iterator over all orientations of a graph

sage: def orientations_up_to_isomorphisms(G):
....:     s = set()
....:     for d in G.orientations():
....:         c = d.canonical_label().copy(immutable=True)
....:         s.add(c)
....:     return s
....: 
sage: D4 = Graph({1: [2], 2: [3,4]})
sage: len(orientations_up_to_isomorphisms(D4))
4
sage: E6 = Graph({1: [2], 2: [3], 3: [4,6], 4: [5]})
sage: len(orientations_up_to_isomorphisms(E6))
20