Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Graph sorting problem

If I do this in Sagemath10.0:

G = Graph()

G.add_vertex('a')

G.add_vertex(1)

print(G.vertices())

I get a deprecation warning but also this error: File ~/sage/sage-10.0/src/sage/graphs/generic_graph.py:11370, in GenericGraph.vertices(self, sort, key, degree, vertex_property) 11367 raise ValueError('sort keyword is False, yet a key function is given') 11369 if sort:

11370 return sorted(self.vertex_iterator(degree=degree, vertex_property=vertex_property), key=key) 11371 return list(self.vertex_iterator(degree=degree, vertex_property=vertex_property))

TypeError: '<' not supported between instances of 'int' and 'str'

According to the documentation, the name of a vertex should be immutable, so an integer and a string should be fine. Is it a bug or am I doing something wrong?

Graph sorting problem

If I do this in Sagemath10.0:SageMath10.0:

G = Graph()

G.add_vertex('a')

G.add_vertex(1)

print(G.vertices())

Graph() G.add_vertex('a') G.add_vertex(1) print(G.vertices())

I get a deprecation warning but also this error: error:

File ~/sage/sage-10.0/src/sage/graphs/generic_graph.py:11370, in GenericGraph.vertices(self, sort, key, degree, vertex_property)
  11367     raise ValueError('sort keyword is False, yet a key function is given')
  11369 if sort:

sort: > 11370 return sorted(self.vertex_iterator(degree=degree, vertex_property=vertex_property), key=key) 11371 return list(self.vertex_iterator(degree=degree, vertex_property=vertex_property))

vertex_property=vertex_property))

TypeError: '<' not supported between instances of 'int' and 'str'

'str'

According to the documentation, the name of a vertex should be immutable, immutable, so an integer and a string should be fine. Is it a bug or am I doing something wrong?