Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Are you sure about eulerian_cycle? I think it's eulerian_circuit in Sage (?). But it does seem to only work for undirected graphs...

I would say this is a start.

sage: D = DiGraph('IRAaDCIIOWEOKcPWAo')
sage: D.is_eulerian()
True

In fact, the code basically finds the circuit, but doesn't keep it like eulerian_circuit does. So it could be modified to keep it, just like eulerian_circuit.

However, things get bad when we convert, because it doesn't keep double edges... hmmm...

sage: E = D.to_undirected()
sage: E.eulerian_circuit()
False

Anyway, this could probably be implemented pretty easily. I highly suggest you post about this on sage-devel, and/or file a ticket at trac.sagemath.org if one doesn't already exist for this.