mode.utils.graphs
¶
-
class
mode.utils.graphs.
GraphFormatter
(root: Any = None, type: str = None, id: str = None, indent: int = 0, inw: str = ' ', **scheme: Any)[source]¶ Format dependency graphs.
-
edge_scheme
= {'arrowcolor': 'black', 'arrowsize': 0.7, 'color': 'darkseagreen4'}¶
-
node_scheme
= {'color': 'palegreen4', 'fillcolor': 'palegreen3'}¶
-
term_scheme
= {'color': 'palegreen2', 'fillcolor': 'palegreen1'}¶
-
scheme
= {'arrowhead': 'vee', 'fontname': 'HelveticaNeue', 'shape': 'box', 'style': 'filled'}¶
-
graph_scheme
= {'bgcolor': 'mintcream'}¶
-
-
class
mode.utils.graphs.
DependencyGraph
(it: Iterable = None, formatter: mode.utils.types.graphs.GraphFormatterT[_T] = None)[source]¶ A directed acyclic graph of objects and their dependencies.
Supports a robust topological sort to detect the order in which they must be handled.
Takes an optional iterator of
(obj, dependencies)
tuples to build the graph from.Warning
Does not support cycle detection.
-
connect
(graph: mode.utils.types.graphs.DependencyGraphT[_T]) → None[source]¶ Add nodes from another graph.
-
topsort
() → Sequence[source]¶ Sort the graph topologically.
- Returns
of objects in the order in which they must be handled.
- Return type
List
-