-
-
Notifications
You must be signed in to change notification settings - Fork 652
Closed
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**: all
- **Sage Version**: 10.1.beta5
Steps To Reproduce
This issue was reported in https://groups.google.com/g/sage-devel/c/grTffw3S15E for feedback_vertex_set
but is actually located in connected_component_containing_vertex
G = Graph([("A",1)])
G.connected_component_containing_vertex(1)
Expected Behavior
['A', 1]
Actual Behavior
sage: G.connected_component_containing_vertex(1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [23], line 1
----> 1 G.connected_component_containing_vertex(Integer(1))
File ~/sage/src/sage/graphs/connectivity.pyx:284, in sage.graphs.connectivity.connected_component_containing_vertex()
282
283 if sort:
--> 284 c.sort()
285 return c
286
TypeError: '<' not supported between instances of 'str' and 'int'
Additional Information
We should deprecate sorting vertices by default in connected_components
and connected_component_containing_vertex
to avoid type errors when vertices are of incomparable types. Users can pass a sorting key to deal with vertices of different types.