#28451 closed defect (fixed)

eulerian_circuit broken for the graph with vertices but no edges

Reported by: tmonteil Owned by:
Priority: major Milestone: sage-8.9
Component: graph theory Keywords:
Cc: Merged in:
Authors: Hendrik Schrezenmaier Reviewers: Thierry Monteil
Report Upstream: N/A Work issues:
Branch: bad58c6 (Commits) Commit: bad58c6d83ecacb9964cf47cac99290b4842dff4
Dependencies: Stopgaps:

Description (last modified by tmonteil)

As deduced from this ask question:

sage: G = Graph()
sage: G.add_vertex(0)
sage: G
Graph on 1 vertex
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-5-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration: 

See also:

sage: G = Graph()
sage: G.add_vertices(range(10))
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-27-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration: 

Change History (5)

comment:1 Changed 10 months ago by tmonteil

  • Description modified (diff)
  • Summary changed from eulerian_circuit broken for the graph with a single vertex to eulerian_circuit broken for the graph with vertices but no edges

comment:2 Changed 10 months ago by gh-hensc

  • Branch set to u/gh-hensc/eulerian_circuit_broken_for_the_graph_with_vertices_but_no_edges

comment:3 Changed 10 months ago by gh-hensc

  • Authors set to Hendrik Schrezenmaier
  • Commit set to bad58c6d83ecacb9964cf47cac99290b4842dff4
  • Status changed from new to needs_review
  • Type changed from enhancement to defect

New commits:

bad58c6fixed bug and added doctest

comment:4 Changed 10 months ago by tmonteil

  • Reviewers set to Thierry Monteil
  • Status changed from needs_review to positive_review

LGTM.

comment:5 Changed 10 months ago by vbraun

  • Branch changed from u/gh-hensc/eulerian_circuit_broken_for_the_graph_with_vertices_but_no_edges to bad58c6d83ecacb9964cf47cac99290b4842dff4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.