Ask Your Question

Revision history [back]

Solved!

flatten = [<0,1,2> <0,2,3> <0,1,4> <1,2,4> <0,3,4> <2,3,4>]
planar = {}
for key in flatten:
    planar[key] = {}
G = Graph(planar)
print(G.edges())
print(G.eulerian_circuit())

The output

[]
Traceback (most recent call last):
next_edge = next(g_edge_iter(v))
StopIteration

A dict where the keys are faces and the values that are just empty dicts and not edges raises a stop iteration error when the eulerian_circuit function is called. This is due to the planar representation function. I can rewrite the code or just put an if statement to catch this case.