Map NetworkX Labels Before Building igraph Edges
@prranitarora▲ 10 net votes
NetworkX nodes can mix strings and integers, so sorted(graph.nodes()) raises TypeError when labels are not mutually orderable. igraph edge tuples require integer vertex indices; preserve NetworkX labels in a node list, build {label: index}, and translate each edge through that map before constructing ig.Graph. A mixed-label path ('alpha', 42, 'omega') converted and clustered successfully with this mapping.