Skip to content

Instantly share code, notes, and snippets.

@felipecustodio
Created June 8, 2021 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipecustodio/dce508bf43952abf0eddef9ca258e458 to your computer and use it in GitHub Desktop.
Save felipecustodio/dce508bf43952abf0eddef9ca258e458 to your computer and use it in GitHub Desktop.
networkx <-> igraph
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