Created
June 8, 2021 17:53
-
-
Save felipecustodio/dce508bf43952abf0eddef9ca258e458 to your computer and use it in GitHub Desktop.
networkx <-> igraph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nx_to_ig(graph): | |
g = ig.Graph.TupleList(graph.edges(), directed=False) | |
return g | |
def ig_to_nx(graph): | |
A = graph.get_edgelist() | |
g = nx.Graph(A) | |
return g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment