ATLAS Offline Software
Loading...
Searching...
No Matches
python.trfGraph.graphNode Class Reference

Vanilla graph node. More...

Inheritance diagram for python.trfGraph.graphNode:
Collaboration diagram for python.trfGraph.graphNode:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self, name, inData, outData, weight=None)
 Graph node constructor.
 name (self)
 inData (self)
 outData (self)
 inputDataTypes (self)
 outputDataTypes (self)
 connections (self)
 weights (self)
 addConnection (self, toExe, data, direction='out')
 Add a new edge connection for this node.
 delConnection (self, toExe, direction='out')
 Delete a connection from this node.
 resetConnections (self)
 Delete all connections.
 __str__ (self)
 __repr__ (self)

Public Attributes

 inData

Protected Member Functions

 _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)

Protected Attributes

 _name = name
 _inData = set(inData)
 _outData = set(outData)
dict _inWeights = {}
 _inputDataTypes = self._flattenSet(self._inData)
 _outputDataTypes = self._flattenSet(self._outData)
dict _connections = {'in': {}, 'out': {}}

Detailed Description

Vanilla graph node.

Definition at line 429 of file trfGraph.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.trfGraph.graphNode.__init__ ( self,
name,
inData,
outData,
weight = None )

Graph node constructor.

Parameters
nameName of this node
indataIterable containing input data connections for this node
outdataIterable containing output data connections for this node
weightWeights (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):
440 self._name = name
441 self._inData = set(inData)
442 self._outData = set(outData)
443
444
446 self._inWeights = {}
447 if weight is None:
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
453 else:
454 # Must be a dictionary with its keys equal to the _inData elements
455 self._inWeights = weight
456
457 self._inputDataTypes = self._flattenSet(self._inData)
458 self._outputDataTypes = self._flattenSet(self._outData)
459
460 # Connections dictionary will hold incoming and outgoing edges - the incoming connections
461 # are very useful for topological ordering. Nested dictionary with 'in', 'out' keys, where
462 # the values are dictionaries with nodeName keys and set(dataTypes) as values.
463 # e.g., {'out': {'_end_HIST': set(['HIST'])}, 'in': {'ESDtoAOD': set(['HIST_AOD']), 'RAWtoESD': set(['HIST_ESD'])}}
464 self._connections = {'in': {}, 'out': {}}
465
STL class.

Member Function Documentation

◆ __repr__()

python.trfGraph.graphNode.__repr__ ( self)

Definition at line 525 of file trfGraph.py.

525 def __repr__(self):
526 return '{0} (dataIn {1}, weights {2}; dataOut {3}; connect {4})'.format(self._name, self._inData, self._inWeights, self._outData, self._connections)
527
528

◆ __str__()

python.trfGraph.graphNode.__str__ ( self)

Definition at line 522 of file trfGraph.py.

522 def __str__(self):
523 return '{0} (dataIn {1} -> dataOut {2})'.format(self._name, self._inData, self._outData)
524

◆ _flattenSet()

python.trfGraph.graphNode._flattenSet ( self,
startSet )
protected

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):
514 flatData = set()
515 for data in startSet:
516 if isinstance(data, (list, tuple)):
517 flatData.update(data)
518 else:
519 flatData.update([data])
520 return flatData
521

◆ addConnection()

python.trfGraph.graphNode.addConnection ( self,
toExe,
data,
direction = 'out' )

Add a new edge connection for this node.

Parameters

c toExe Other node for this edge

Parameters

c data Data which connects these nodes (iterable), converted to set object

Parameters

c direction If this is an incoming or outgoing edge for this node

Definition at line 498 of file trfGraph.py.

498 def addConnection(self, toExe, data, direction = 'out'):
499 self._connections[direction][toExe] = set(data)
500

◆ connections()

python.trfGraph.graphNode.connections ( self)

Definition at line 487 of file trfGraph.py.

487 def connections(self):
488 return self._connections
489

◆ delConnection()

python.trfGraph.graphNode.delConnection ( self,
toExe,
direction = 'out' )

Delete a connection from this node.

Parameters

c toExe Other node for this vertex

Parameters

c direction If this is an incoming or outgoing edge for this node

Definition at line 504 of file trfGraph.py.

504 def delConnection(self, toExe, direction = 'out'):
505 del self._connections[direction][toExe]
506

◆ inData()

python.trfGraph.graphNode.inData ( self)

Definition at line 471 of file trfGraph.py.

471 def inData(self):
472 return self._inData
473

◆ inputDataTypes()

python.trfGraph.graphNode.inputDataTypes ( self)

Definition at line 479 of file trfGraph.py.

479 def inputDataTypes(self):
480 return self._flattenSet(self.inData)
481

◆ name()

python.trfGraph.graphNode.name ( self)

Definition at line 467 of file trfGraph.py.

467 def name(self):
468 return self._name
469

◆ outData()

python.trfGraph.graphNode.outData ( self)

Definition at line 475 of file trfGraph.py.

475 def outData(self):
476 return self._outData
477

◆ outputDataTypes()

python.trfGraph.graphNode.outputDataTypes ( self)

Definition at line 483 of file trfGraph.py.

483 def outputDataTypes(self):
484 return self._flattenSet(self._outData)
485

◆ resetConnections()

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': {}}
510

◆ weights()

python.trfGraph.graphNode.weights ( self)

Definition at line 491 of file trfGraph.py.

491 def weights(self):
492 return self._inWeights
493

Member Data Documentation

◆ _connections

python.trfGraph.graphNode._connections = {'in': {}, 'out': {}}
protected

Definition at line 464 of file trfGraph.py.

◆ _inData

python.trfGraph.graphNode._inData = set(inData)
protected

Definition at line 441 of file trfGraph.py.

◆ _inputDataTypes

python.trfGraph.graphNode._inputDataTypes = self._flattenSet(self._inData)
protected

Definition at line 457 of file trfGraph.py.

◆ _inWeights

python.trfGraph.graphNode._inWeights = {}
protected
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 = name
protected

Definition at line 440 of file trfGraph.py.

◆ _outData

python.trfGraph.graphNode._outData = set(outData)
protected

Definition at line 442 of file trfGraph.py.

◆ _outputDataTypes

python.trfGraph.graphNode._outputDataTypes = self._flattenSet(self._outData)
protected

Definition at line 458 of file trfGraph.py.

◆ inData

python.trfGraph.graphNode.inData

Definition at line 480 of file trfGraph.py.


The documentation for this class was generated from the following file: