Skip to content

Commit fe163ac

Browse files
committed
Support networkx 3.2
In networkx 3.2 the output for cycle_basis() has changed. After a discussion in #36486 it seems that checking that the output is correct would not be easy. In the spirit of supporting networkx 3.2 at the same time as networkx 3.1, the easiest way is to mark these five tests as random output.
1 parent 07a2afd commit fe163ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5102,13 +5102,13 @@ def cycle_basis(self, output='vertex'):
51025102
A cycle basis in Petersen's Graph ::
51035103

51045104
sage: g = graphs.PetersenGraph()
5105-
sage: g.cycle_basis() # needs networkx
5105+
sage: g.cycle_basis() # needs networkx, random (changes in networkx 3.2)
51065106
[[1, 6, 8, 5, 0], [4, 9, 6, 8, 5, 0], [7, 9, 6, 8, 5],
51075107
[4, 3, 8, 5, 0], [1, 2, 3, 8, 5, 0], [7, 2, 3, 8, 5]]
51085108

51095109
One can also get the result as a list of lists of edges::
51105110

5111-
sage: g.cycle_basis(output='edge') # needs networkx
5111+
sage: g.cycle_basis(output='edge') # needs networkx, random (changes in networkx 3.2)
51125112
[[(1, 6, None), (6, 8, None), (8, 5, None), (5, 0, None),
51135113
(0, 1, None)], [(4, 9, None), (9, 6, None), (6, 8, None),
51145114
(8, 5, None), (5, 0, None), (0, 4, None)], [(7, 9, None),
@@ -5273,17 +5273,17 @@ def minimum_cycle_basis(self, algorithm=None, weight_function=None, by_weight=Fa
52735273
[[1, 2, 3], [1, 2, 3, 4], [5, 6, 7]]
52745274
sage: sorted(g.minimum_cycle_basis(by_weight=False))
52755275
[[1, 2, 3], [1, 3, 4], [5, 6, 7]]
5276-
sage: sorted(g.minimum_cycle_basis(by_weight=True, algorithm='NetworkX')) # needs networkx
5276+
sage: sorted(g.minimum_cycle_basis(by_weight=True, algorithm='NetworkX')) # needs networkx, random (changes in networkx 3.2)
52775277
[[1, 2, 3], [1, 2, 3, 4], [5, 6, 7]]
5278-
sage: g.minimum_cycle_basis(by_weight=False, algorithm='NetworkX') # needs networkx
5278+
sage: g.minimum_cycle_basis(by_weight=False, algorithm='NetworkX') # needs networkx, random (changes in networkx 3.2)
52795279
[[1, 2, 3], [1, 3, 4], [5, 6, 7]]
52805280

52815281
::
52825282

52835283
sage: g = Graph([(1, 2), (2, 3), (3, 4), (4, 5), (5, 1), (5, 3)])
52845284
sage: sorted(g.minimum_cycle_basis(by_weight=False))
52855285
[[1, 2, 3, 5], [3, 4, 5]]
5286-
sage: sorted(g.minimum_cycle_basis(by_weight=False, algorithm='NetworkX')) # needs networkx
5286+
sage: sorted(g.minimum_cycle_basis(by_weight=False, algorithm='NetworkX')) # needs networkx, random (changes in networkx 3.2)
52875287
[[1, 2, 3, 5], [3, 4, 5]]
52885288

52895289
TESTS::

0 commit comments

Comments
 (0)