Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 6e239eb

Browse files
committed
28531: pass parameters to bliss canonical_form
1 parent dffbb69 commit 6e239eb

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23020,6 +23020,36 @@ class by some canonization function `c`. If `G` and `H` are graphs,
2302023020
Path graph: Graph on 1 vertex
2302123021
sage: g.canonical_label(algorithm='bliss') # optional - bliss
2302223022
Path graph: Graph on 1 vertex
23023+
23024+
Check that :trac:`28531` is fixed::
23025+
23026+
sage: from itertools import product, permutations
23027+
sage: edges_list = [[(0,1), (2,3)],
23028+
....: [(0,1), (1,2), (2,3)],
23029+
....: [(0,1), (0,2), (1,2)],
23030+
....: [(0,1), (0,2), (0,3)]]
23031+
sage: algos = ['sage']
23032+
sage: algos.append('bliss') # optional - bliss
23033+
sage: S = Set([0,1,2])
23034+
sage: for (algo, edges) in product(algos, edges_list):
23035+
....: L = cartesian_product([S] * len(edges))
23036+
....: O = OrderedSetPartitions([0,1,2,3])
23037+
....: P = Permutations([0,1,2,3])
23038+
....: for _ in range(10):
23039+
....: part = O.random_element()
23040+
....: labels = L.random_element()
23041+
....: g = Graph(4)
23042+
....: g.add_edges([(u,v,lab) for ((u,v),lab) in zip(edges, labels)])
23043+
....: gcan0 = g.canonical_label(partition=part, edge_labels=True, return_graph=True, algorithm=algo)
23044+
....: for _ in range(5):
23045+
....: perm = P.random_element()
23046+
....: gg = Graph(4)
23047+
....: gg.add_edges([(perm[u], perm[v], lab) for u,v,lab in g.edges()])
23048+
....: pp = [[perm[i] for i in s] for s in part]
23049+
....: gcan1 = gg.canonical_label(partition=pp, edge_labels=True, algorithm=algo)
23050+
....: gcan2, _ = gg.canonical_label(partition=pp, edge_labels=True, certificate=True, algorithm=algo)
23051+
....: assert gcan0 == gcan1, (edges, labels, part, pp)
23052+
....: assert gcan0 == gcan2, (edges, labels, part, pp)
2302323053
"""
2302423054
# Deprecation
2302523055
if verbosity != 0:
@@ -23050,11 +23080,11 @@ class by some canonization function `c`. If `G` and `H` are graphs,
2305023080

2305123081
if algorithm == 'bliss':
2305223082
if return_graph:
23053-
vert_dict = canonical_form(self, partition, certificate=True)[1]
23083+
vert_dict = canonical_form(self, partition, False, edge_labels, True)[1]
2305423084
if not certificate:
2305523085
return self.relabel(vert_dict, inplace=False)
2305623086
return (self.relabel(vert_dict, inplace=False), vert_dict)
23057-
return canonical_form(self, partition, return_graph, certificate)
23087+
return canonical_form(self, partition, return_graph, edge_labels, certificate)
2305823088

2305923089
# algorithm == 'sage':
2306023090
from sage.groups.perm_gps.partn_ref.refinement_graphs import search_tree

0 commit comments

Comments
 (0)