Class DependencyGraph

Class Documentation

class DependencyGraph

This class represents the dependency tree for agent functions, host functions and submodels. Each DependencyNode has its own dependencies/dependents, the purpose of this class is to walk the dependency tree and provide utility such as validation/layering.

See also

DependencyNode

Public Functions

explicit DependencyGraph(ModelData *_model)

Constructors Used by ModelData for instantiation

explicit DependencyGraph(const DependencyGraph &other)

Deep copy

bool operator==(const DependencyGraph &rhs)

Equality operator, checks whether DependencyGraphs are functionally the same, i.e, do they represent the same execution graph

Note

Instead compare pointers if you wish to check that they are the same instance

Returns:

True when both graphs represent the same execution graph

void addRoot(DependencyNode &root)

Add an AgentFunctionDescription, host function or submodel as a root node

Parameters:

root – The function or submodel to add to the graph as a root

void generateLayers()

Generates optimal layers based on the dependencies specified and adds them to the model

Parameters:

model – The model the layers should be added to

Throws:

exception::InvalidDependencyGraph – if the model already has layers attached

void generateDOTDiagram(std::string outputFileName) const

Generates a .gv file containing the DOT representation of the dependencies specified

Parameters:

outputFileName – The name of the output file

bool validateDependencyGraph() const

Checks the dependency graph for cycles and validates that all agent functions belong to the same model

Returns:

True when the graph is valid, i.e. it contains no cycles

std::string getConstructedLayersString() const

Returns a string representation of the constructed layers

Returns:

A string representation of the constructed layers