-
-
Notifications
You must be signed in to change notification settings - Fork 657
Closed
Description
The following code illustrates the problem that two bipartite graph B1
and B2
(both canonically labeled) are claimed to be equal and have equal hashes, while they are NOT isomorphic, let alone equal, as labeled graphs.
When labels are ignored, these graphs are isomorphic, and so the problem may be caused by equality testing / hash()
function somehow ignoring edge labels.
B1 = BipartiteGraph( [(0, 11, 2), (0, 12, 1), (0, 14, 1), (0, 16, 1), (1, 10, 1), (1, 13, 1), (1, 14, 2), (1, 16, 1), (2, 10, 2), (2, 11, 1), (2, 15, 1), (2, 16, 1), (3, 10, 1), (3, 12, 1), (3, 16, 2), (3, 17, 1), (4, 11, 1), (4, 13, 1), (4, 15, 2), (4, 17, 1), (5, 9, 2), (5, 14, 1), (5, 15, 1), (5, 17, 1), (6, 9, 1), (6, 13, 2), (6, 16, 1), (6, 17, 1), (7, 9, 1), (7, 10, 1), (7, 11, 1), (7, 12, 2), (7, 14, 1), (8, 9, 1), (8, 12, 1), (8, 13, 1), (8, 15, 1), (8, 17, 2)], immutable=True )
B2 = BipartiteGraph( [(0, 11, 1), (0, 12, 1), (0, 14, 2), (0, 16, 1), (1, 10, 2), (1, 13, 1), (1, 14, 1), (1, 16, 1), (2, 10, 1), (2, 11, 2), (2, 15, 1), (2, 16, 1), (3, 10, 1), (3, 12, 1), (3, 16, 2), (3, 17, 1), (4, 11, 1), (4, 13, 1), (4, 15, 2), (4, 17, 1), (5, 9, 2), (5, 14, 1), (5, 15, 1), (5, 17, 1), (6, 9, 1), (6, 13, 2), (6, 16, 1), (6, 17, 1), (7, 9, 1), (7, 10, 1), (7, 11, 1), (7, 12, 2), (7, 14, 1), (8, 9, 1), (8, 12, 1), (8, 13, 1), (8, 15, 1), (8, 17, 2)], immutable=True )
print('Same hashes:', hash(B1) == hash(B2) )
print('Isomorphic:', B1.is_isomorphic( B2, edge_labels=True ) )
print('Equal:', B1 == B2)
Component: graph theory
Issue created by migration from https://trac.sagemath.org/ticket/33255