pyworkflow.utils.graph module

This module define a Graph class and some utilities

class pyworkflow.utils.graph.Graph(rootName='ROOT', root=None)[source]

Bases: object

Simple directed Graph class. Implemented using adjacency lists.

aliasNode(node, aliasName)[source]

Register an alias name for the node.

createNode(nodeName, nodeLabel=None)[source]

Add a node to the graph

getNode(nodeName)[source]
getNodes()[source]
getRoot()[source]
getRootNodes()[source]

Return all nodes that have no parent.

printDot(useId=True)[source]

If useId is True, use the node id for label the graph. If not, use the run name.

printNodes()[source]
class pyworkflow.utils.graph.Node(name=None, label=None)[source]

Bases: object

A node inside the graph.

addChild(*nodes)[source]
getChilds()[source]
getLabel()[source]
getName()[source]
getParent()[source]

Return the first parent in the list, if the node isRoot, None is returned.

getParents()[source]
isRoot()[source]
iterChilds()[source]

Iterate over all childs and subchilds. Nodes can be visited more than once if have more than one parent.

iterChildsBreadth()[source]

Iter child nodes in a breadth-first order

setLabel(newLabel)[source]