Vanilla graph node.
More...
|
def | _flattenSet (self, startSet) |
| Take a list and return all simple members plus the members of any list/tuples in the set (i.e., flatten out multiple input tuples) More...
|
|
Vanilla graph node.
Definition at line 429 of file trfGraph.py.
◆ __init__()
def python.trfGraph.graphNode.__init__ |
( |
|
self, |
|
|
|
name, |
|
|
|
inData, |
|
|
|
outData, |
|
|
|
weight = None |
|
) |
| |
Graph node constructor.
- Parameters
-
name | Name of this node |
indata | Iterable containing input data connections for this node |
outdata | Iterable containing output data connections for this node |
weight | Weights (relative execution cost) for each input connection to this node |
- Note
- For
inData
and outData
a list, tuple or set is acceptable. Multiple input data types should be expressed as lists or tuples themselves, e.g., [('HIST_AOD', 'HIST_ESD')]
. They cannot be sets themselves as python sets cannot contain other sets.
Definition at line 439 of file trfGraph.py.
439 def __init__(self, name, inData, outData, weight = None):
441 self._inData =
set(inData)
442 self._outData =
set(outData)
448 for data
in self._inData:
449 self._inWeights[data] = 1
450 elif isinstance(weight, int):
451 for data
in self._inData:
452 self._inWeights[data] = weight
455 self._inWeights = weight
457 self._inputDataTypes = self._flattenSet(self._inData)
458 self._outputDataTypes = self._flattenSet(self._outData)
464 self._connections = {
'in': {},
'out': {}}
◆ __repr__()
def python.trfGraph.graphNode.__repr__ |
( |
|
self | ) |
|
Definition at line 525 of file trfGraph.py.
526 return '{0} (dataIn {1}, weights {2}; dataOut {3}; connect {4})'.
format(self._name, self._inData, self._inWeights, self._outData, self._connections)
◆ __str__()
def python.trfGraph.graphNode.__str__ |
( |
|
self | ) |
|
Definition at line 522 of file trfGraph.py.
523 return '{0} (dataIn {1} -> dataOut {2})'.
format(self._name, self._inData, self._outData)
◆ _flattenSet()
def python.trfGraph.graphNode._flattenSet |
( |
|
self, |
|
|
|
startSet |
|
) |
| |
|
private |
Take a list and return all simple members plus the members of any list/tuples in the set (i.e., flatten out multiple input tuples)
Definition at line 513 of file trfGraph.py.
513 def _flattenSet(self, startSet):
515 for data
in startSet:
516 if isinstance(data, (list, tuple)):
517 flatData.update(data)
519 flatData.update([data])
◆ addConnection()
def python.trfGraph.graphNode.addConnection |
( |
|
self, |
|
|
|
toExe, |
|
|
|
data, |
|
|
|
direction = 'out' |
|
) |
| |
Add a new edge connection for this node.
- Parameters
-
Definition at line 498 of file trfGraph.py.
499 self._connections[direction][toExe] =
set(data)
◆ connections()
def python.trfGraph.graphNode.connections |
( |
|
self | ) |
|
Definition at line 487 of file trfGraph.py.
487 def connections(self):
488 return self._connections
◆ delConnection()
def python.trfGraph.graphNode.delConnection |
( |
|
self, |
|
|
|
toExe, |
|
|
|
direction = 'out' |
|
) |
| |
Delete a connection from this node.
- Parameters
-
Definition at line 504 of file trfGraph.py.
504 def delConnection(self, toExe, direction = 'out'):
505 del self._connections[direction][toExe]
◆ inData()
def python.trfGraph.graphNode.inData |
( |
|
self | ) |
|
◆ inputDataTypes()
def python.trfGraph.graphNode.inputDataTypes |
( |
|
self | ) |
|
Definition at line 479 of file trfGraph.py.
479 def inputDataTypes(self):
480 return self._flattenSet(self.inData)
◆ name()
def python.trfGraph.graphNode.name |
( |
|
self | ) |
|
◆ outData()
def python.trfGraph.graphNode.outData |
( |
|
self | ) |
|
◆ outputDataTypes()
def python.trfGraph.graphNode.outputDataTypes |
( |
|
self | ) |
|
Definition at line 483 of file trfGraph.py.
483 def outputDataTypes(self):
484 return self._flattenSet(self._outData)
◆ resetConnections()
def python.trfGraph.graphNode.resetConnections |
( |
|
self | ) |
|
Delete all connections.
Definition at line 508 of file trfGraph.py.
508 def resetConnections(self):
509 self._connections = {
'in': {},
'out': {}}
◆ weights()
def python.trfGraph.graphNode.weights |
( |
|
self | ) |
|
Definition at line 491 of file trfGraph.py.
492 return self._inWeights
◆ _connections
python.trfGraph.graphNode._connections |
|
private |
◆ _inData
python.trfGraph.graphNode._inData |
|
private |
◆ _inputDataTypes
python.trfGraph.graphNode._inputDataTypes |
|
private |
◆ _inWeights
python.trfGraph.graphNode._inWeights |
|
private |
- Note
_inWeights
takes the form of a dictionary, keyed by input data type and giving the relative cost of executing this node with those input data types.
Definition at line 446 of file trfGraph.py.
◆ _name
python.trfGraph.graphNode._name |
|
private |
◆ _outData
python.trfGraph.graphNode._outData |
|
private |
◆ _outputDataTypes
python.trfGraph.graphNode._outputDataTypes |
|
private |
The documentation for this class was generated from the following file:
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.