Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Jan 7, 2020
1 parent 81e99e6 commit f4423f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/sage/graphs/base/c_graph.pyx
Expand Up @@ -606,9 +606,7 @@ cdef class CGraph:
sage: G.verts()
[1, 2]
"""
cdef int i
return [i for i in range(<int>self.active_vertices.size)
if bitset_in(self.active_vertices, i)]
return bitset_list(self.active_vertices)

cpdef realloc(self, int total):
"""
Expand Down Expand Up @@ -1842,11 +1840,12 @@ cdef class CGraphBackend(GenericGraphBackend):
if verts is None:
for x in self.vertex_ints:
yield x
for i in range(self._cg.active_vertices.size):
if (bitset_in(self._cg.active_vertices, i)
and i not in self.vertex_labels
i = bitset_first(self._cg.active_vertices)
while i != -1:
if (i not in self.vertex_labels
and i not in self.vertex_ints):
yield i
i = bitset_next(self._cg.active_vertices, i + 1)
return

try:
Expand Down
2 changes: 2 additions & 0 deletions src/sage/graphs/generic_graph.py
Expand Up @@ -11058,6 +11058,8 @@ def subdivide_edges(self, edges, k):

- :meth:`subdivide_edge` -- subdivides one edge
"""
if isinstance(edges, EdgesView):
edges = tuple(edges)
for e in edges:
self.subdivide_edge(e, k)

Expand Down

0 comments on commit f4423f0

Please sign in to comment.