dependency_graph

ModelsDict.dependency_graph(deep=False)[source]

Returns a NetworkX graph object of the dependencies

Parameters

deep (bool, optional) – Defines whether intra- or inter-object dependency graph is desired. Default is False, i.e. only returns dependencies within the object.

Notes

To visualize the dependencies, the following NetworkX function and settings is helpful:

import networkx as nx
import openpnm as op
import matplotlib.pyplot as plt

net = op.network.Cubic(shape=[3, 3, 3])
geo = op.geometry.SpheresAndCylinders(network=net,
                                      pores=net.Ps,
                                      throats=net.Ts)

dtree = geo.models.dependency_graph()
nx.draw_spectral(dtree,
                 arrowsize=50,
                 font_size=32,
                 with_labels=True,
                 node_size=2000,
                 width=3.0,
                 edge_color='lightgrey',
                 font_weight='bold')

plt.show()
../../_images/openpnm-core-ModelsDict-dependency_graph-1.svg