Skip to content

Commit 104c080

Browse files
committed
fix: fixed failing unit tests, now we are up-to-date again with the develop branch of the C core
1 parent 4ff5c92 commit 104c080

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/_igraph/graphobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10144,7 +10144,7 @@ PyObject *igraphmodule_Graph_canonical_permutation(
1014410144
if (igraphmodule_attrib_to_vector_int_t(color_o, self, &color,
1014510145
ATTRIBUTE_TYPE_VERTEX)) return NULL;
1014610146

10147-
retval = igraph_canonical_permutation_bliss(&self->g, color, &labeling, sh, 0);
10147+
retval = igraph_canonical_permutation(&self->g, color, &labeling);
1014810148

1014910149
if (color) { igraph_vector_int_destroy(color); free(color); }
1015010150

src/igraph/operators/functions.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def union(graphs, byname="auto"):
158158
raise RuntimeError(
159159
f"Some graphs are not named (got {n_named} named, {ngr-n_named} unnamed)"
160160
)
161-
# Now we know that byname is only used is all graphs are named
161+
# Now we know that byname is only used if all graphs are named
162162

163163
# Trivial cases
164164
if ngr == 0:
@@ -184,7 +184,12 @@ def union(graphs, byname="auto"):
184184
# Reorder vertices to match uninames
185185
# vertex k -> p[k]
186186
permutation = [permutation_map[x] for x in ng.vs["name"]]
187-
ng = ng.permute_vertices(permutation)
187+
188+
# permute_vertices() needs the inverse permutation
189+
inv_permutation = [0] * len(permutation)
190+
for i, x in enumerate(permutation):
191+
inv_permutation[x] = i
192+
ng = ng.permute_vertices(inv_permutation)
188193

189194
newgraphs.append(ng)
190195
else:
@@ -353,7 +358,7 @@ def intersection(graphs, byname="auto", keep_all_vertices=True):
353358
raise RuntimeError(
354359
f"Some graphs are not named (got {n_named} named, {ngr-n_named} unnamed)"
355360
)
356-
# Now we know that byname is only used is all graphs are named
361+
# Now we know that byname is only used if all graphs are named
357362

358363
# Trivial cases
359364
if ngr == 0:
@@ -389,7 +394,12 @@ def intersection(graphs, byname="auto", keep_all_vertices=True):
389394
# Reorder vertices to match uninames
390395
# vertex k -> p[k]
391396
permutation = [permutation_map[x] for x in ng.vs["name"]]
392-
ng = ng.permute_vertices(permutation)
397+
398+
# permute_vertices() needs the inverse permutation
399+
inv_permutation = [0] * len(permutation)
400+
for i, x in enumerate(permutation):
401+
inv_permutation[x] = i
402+
ng = ng.permute_vertices(inv_permutation)
393403

394404
newgraphs.append(ng)
395405
else:

0 commit comments

Comments
 (0)