graph.py

class openmdao.util.graph.OrderedDigraph(data=None, **attr)[source]

Bases: networkx.classes.digraph.DiGraph

adjlist_dict_factory

alias of OrderedDict

edge_attr_dict_factory

alias of OrderedDict

node_dict_factory

alias of OrderedDict

openmdao.util.graph.break_strongly_connected(parent, broken_edges, scc)[source]

Breaks strongly connected components. Called recursively until all such cycles are broken.

Args:

parent : nx.DiGraph

Directed graph from which the SCCs are drawn.

broken_edges : list

List to which broken edges are appended.

scc : list

List of nodes that make up a single SCC.

openmdao.util.graph.collapse_nodes(graph, node_map, copy=False)[source]
Args:

graph : nx.DiGraph

Graph with nodes we want to collapse.

node_map : dict

A map of existing node names to collapsed names.

copy : bool(False)

If True, copy the graph before collapsing the nodes.

Returns:

nx.DiGraph

The graph with the nodes collapsed.

openmdao.util.graph.plain_bfs(G, source)[source]

A fast BFS node generator

The direction of the edge between nodes is ignored.

For directed graphs only.