Skip to content

Commit

Permalink
sagemath#39287: add tests on disconnected (di)graphs to make codecov …
Browse files Browse the repository at this point in the history
…happy
  • Loading branch information
dcoudert committed Feb 15, 2025
1 parent ed91201 commit 7211b9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sage/graphs/generic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -20637,9 +20637,13 @@ def transitive_reduction(self, immutable=None):
sage: g = graphs.CompleteGraph(5)
sage: h = g.transitive_reduction(); h.size()
4
sage: (2*g).transitive_reduction().size()
8
sage: g = DiGraph({0: [1, 2], 1: [2, 3, 4, 5], 2: [4, 5]})
sage: g.transitive_reduction().size()
5
sage: (2*g).transitive_reduction().size()
10

TESTS:

Expand Down Expand Up @@ -20690,7 +20694,7 @@ def transitive_reduction(self, immutable=None):
CC = [self]
else:
CC = (self.subgraph(c)
for c in self.connected_components() if len(c) > 1)
for c in self.connected_components(sort=False) if len(c) > 1)

def edges():
for g in CC:
Expand Down

0 comments on commit 7211b9f

Please sign in to comment.