Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in is_eulerian #35170

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/sage/graphs/generic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4115,12 +4115,18 @@ def is_eulerian(self, path=False):

sage: g = Graph({0:[], 1:[], 2:[], 3:[]}); g.is_eulerian()
True
"""

Issue :trac:`35168` is fixed::

sage: Graph([[0, 42, 'John'], [(42, 0)]]).is_eulerian()
False
sage: Graph([[0, 42, 'John'], [(42, 'John')]]).is_eulerian()
False
"""
# unconnected graph can still be Eulerian if all components
# up to one doesn't contain any edge
nontrivial_components = 0
for cc in self.connected_components():
for cc in self.connected_components(sort=False):
if len(cc) > 1:
nontrivial_components += 1
if nontrivial_components > 1:
Expand Down