Ask Your Question

Revision history [back]

Thanks. This is the fix (the whole id_label business was a leftover from an old buggy implementation of the modular decomposition, now replaced with this one. Will be fixed in the upcoming release.

diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 617881e4a7..57504aaecd 100644
--- a/src/sage/graphs/graph.py
+++ b/src/sage/graphs/graph.py
@@ -7180,9 +7180,7 @@ class Graph(GenericGraph):

         D = modular_decomposition(self)

-        id_label = dict(enumerate(self.vertices()))
-
-        relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type !=NodeType.NORMAL else id_label[x.children[0]]
+        relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else x.children[0]

          return relabel(D)