DAG

Soft implementation of a Direct Acyclic Graph (DAG)

Nota Bene: It is NOT fully checked if valid (i.e. some cycle can be introduced)!

class DIRAC.Core.Utilities.DAG.DAG

Bases: object

a Direct Acyclic Graph (DAG)

Represented as a dictionary whose keys are nodes, and values are sets holiding their dependencies

__init__()

Defines graph variable holding the dag representation

addEdge(fromNode, toNode)

add an edge (checks if both nodes exist)

Parameters:
addNode(node)

add a node to graph

Parameters:node (object) – Any type of object - if not hashable, it will be converted to a frozenset
getIndexNodes()

Return a list of index nodes

getList()

Returns a list out of the DAG, if possible

DIRAC.Core.Utilities.DAG.checkNode(node)

Returns a hashable version of node

DIRAC.Core.Utilities.DAG.makeFrozenSet(ob)

Makes a hash from a dictionary, list, tuple or set to any level, that contains only other hashable types (including any lists, tuples, sets, and dictionaries).

DIRAC.Core.Utilities.DAG.unHashNode(node)

Returns a dict or list, if node is frozenset