ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
python.trfGraph.graphNode Class Reference

Vanilla graph node. More...

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

Public Member Functions

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

Private Member Functions

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...
 

Private Attributes

 _name
 
 _inData
 
 _outData
 
 _inWeights
 
 _inputDataTypes
 
 _outputDataTypes
 
 _connections
 

Detailed Description

Vanilla graph node.

Definition at line 429 of file trfGraph.py.

Constructor & Destructor Documentation

◆ __init__()

def 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 

Member Function Documentation

◆ __repr__()

def 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__()

def 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()

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):
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()

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.

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

◆ connections()

def python.trfGraph.graphNode.connections (   self)

Definition at line 487 of file trfGraph.py.

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

◆ 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]
506 

◆ inData()

def python.trfGraph.graphNode.inData (   self)

Definition at line 471 of file trfGraph.py.

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

◆ 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)
481 

◆ name()

def python.trfGraph.graphNode.name (   self)

Definition at line 467 of file trfGraph.py.

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

◆ outData()

def python.trfGraph.graphNode.outData (   self)

Definition at line 475 of file trfGraph.py.

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

◆ 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)
485 

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

◆ weights()

def 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
private

Definition at line 464 of file trfGraph.py.

◆ _inData

python.trfGraph.graphNode._inData
private

Definition at line 441 of file trfGraph.py.

◆ _inputDataTypes

python.trfGraph.graphNode._inputDataTypes
private

Definition at line 457 of file trfGraph.py.

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

Definition at line 440 of file trfGraph.py.

◆ _outData

python.trfGraph.graphNode._outData
private

Definition at line 442 of file trfGraph.py.

◆ _outputDataTypes

python.trfGraph.graphNode._outputDataTypes
private

Definition at line 458 of file trfGraph.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
HLTCFDot.addConnection
def addConnection(nodeA, nodeB, label='')
Definition: HLTCFDot.py:259
CxxUtils::set
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.
Definition: bitmask.h:232
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
weights
Definition: herwig7_interface.h:44
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18