Skip to content

Instantly share code, notes, and snippets.

@diije
Created May 1, 2018 12:43
Show Gist options
  • Save diije/193ec57d7e1347db91c52699c4f08ccd to your computer and use it in GitHub Desktop.
Save diije/193ec57d7e1347db91c52699c4f08ccd to your computer and use it in GitHub Desktop.
Converting from Networkx to Python-Igraph
import networkx as nx
Gnx = nx.path_graph(4) # Create a random NX graph
nx.write_graphml(G,'graph.graphml') # Export NX graph to file
import igraph as ig
Gix = ig.read('graph.graphml',format="graphml") # Create new IG graph from file
@diije
Copy link
Author

diije commented Dec 17, 2020

@thepunitsingh igraph lib might have evolved a bit since I published this gist. Check the docs: https://igraph.org/python/doc/igraph.GraphBase-class.html#Read_GraphML

@JIBarrionuevoGaltier
Copy link

Great! Your solution help me! Thank!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment