Skip to content

Commit c477978

Browse files
author
Shashank R
committed
fix GiulioRossetti#241: ensure convert_graph_formats() handles nodes that are neither strings nor ints
1 parent f8fd1a9 commit c477978

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cdlib/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ def __from_nx_to_igraph(g: object, directed: bool = None) -> object:
132132
gi.add_edges([("\\" + str(u), "\\" + str(v)) for (u, v) in g.edges()])
133133

134134
if bipartite.is_bipartite(g) and not skip_bipartite:
135+
convert = {str(x):x for x in g.nodes()}
135136
gi.vs["type"] = [
136-
a_r[name] if type(name) == int else a_r[int(name.replace("\\", ""))]
137+
a_r[name] if type(name) == int else a_r[convert[name.replace("\\", "")]]
137138
for name in gi.vs["name"]
138139
]
139140

0 commit comments

Comments
 (0)