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


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


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


True when both graphs represent the same execution graph

void addRoot(DependencyNode &root)

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


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


model – The model the layers should be added to


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


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


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

std::string getConstructedLayersString() const

Returns a string representation of the constructed layers


A string representation of the constructed layers