-
-
Notifications
You must be signed in to change notification settings - Fork 655
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues for a bug report that matches the one I want to file, without success.
Did you read the documentation and troubleshoot guide?
- I have read the documentation and troubleshoot guide
Environment
- **OS**: Debian 11
- **Sage Version**: 9.8
Steps To Reproduce
G = Graph ([[0, 42, 'John'], [(42, 0)]])
print (G.is_eulerian())
H = Graph ([[0, 42, 'John'], [(42, 'John')]])
print (H.is_eulerian())
Expected Behavior
False
False
Actual Behavior
False
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [4], line 1
----> 1 H.is_eulerian()
File ~/src/sage-9.8/src/sage/graphs/generic_graph.py:4123, in GenericGraph.is_eulerian(self, path)
4120 # unconnected graph can still be Eulerian if all components
4121 # up to one doesn't contain any edge
4122 nontrivial_components = 0
-> 4123 for cc in self.connected_components():
4124 if len(cc) > 1:
4125 nontrivial_components += 1
File ~/src/sage-9.8/src/sage/graphs/connectivity.pyx:169, in sage.graphs.connectivity.connected_components()
167 for v in G:
168 if v not in seen:
--> 169 c = connected_component_containing_vertex(G, v, sort=sort)
170 seen.update(c)
171 components.append(c)
File ~/src/sage-9.8/src/sage/graphs/connectivity.pyx:287, in sage.graphs.connectivity.connected_component_containing_vertex()
285
286 if sort:
--> 287 c.sort()
288 return c
289
File ~/src/sage-9.8/src/sage/rings/integer.pyx:916, in sage.rings.integer.Integer.__richcmp__()
914 c = mpz_cmp_d((<Integer>left).value, d)
915 else:
--> 916 return coercion_model.richcmp(left, right, op)
917
918 return rich_to_bool_sgn(op, c)
File ~/src/sage-9.8/src/sage/structure/coerce.pyx:2008, in sage.structure.coerce.CoercionModel.richcmp()
2006 raise bin_op_exception('<=', x, y)
2007 elif op == Py_GT:
-> 2008 raise bin_op_exception('>', x, y)
2009 else:
2010 raise bin_op_exception('>=', x, y)
TypeError: unsupported operand parent(s) for >: 'Integer Ring' and '<class 'str'>'
Additional Information
When a graph contains vertices that are non comparable (like integers and strings) in the same connected components, calling is_eulerian
on this graph raises a TypeError
.
williamstein