from_networkx#

from_networkx(G, project=None)[source]#

Add data to an OpenPNM Network from a undirected NetworkX graph object.

Parameters
  • G (networkx.classes.graph.Graph Object) – The NetworkX graph. G should be undirected. The numbering of nodes should be numeric (int’s), zero-based and should not contain any gaps, i.e. G.nodes() = [0,1,3,4,5] is not allowed and should be mapped to G.nodes() = [0,1,2,3,4].

  • project (Project) – A GenericNetwork is created and added to the specified Project. If no Project is supplied then one will be created and returned.

Returns

  • An OpenPNM Project containing a GenericNetwork with all the data from

  • the NetworkX object.