Skip to content

Commit

Permalink
fix GiulioRossetti#241: ensure convert_graph_formats() handles nodes …
Browse files Browse the repository at this point in the history
…that are neither strings nor ints
  • Loading branch information
Shashank R committed Jun 1, 2024
1 parent f8fd1a9 commit c477978
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cdlib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ def __from_nx_to_igraph(g: object, directed: bool = None) -> object:
gi.add_edges([("\\" + str(u), "\\" + str(v)) for (u, v) in g.edges()])

if bipartite.is_bipartite(g) and not skip_bipartite:
convert = {str(x):x for x in g.nodes()}
gi.vs["type"] = [
a_r[name] if type(name) == int else a_r[int(name.replace("\\", ""))]
a_r[name] if type(name) == int else a_r[convert[name.replace("\\", "")]]
for name in gi.vs["name"]
]

Expand Down

0 comments on commit c477978

Please sign in to comment.