Icarus
Vehicle Simulation as a Transformable Computational Graph, built on Vulcan and Janus
Loading...
Searching...
No Matches
icarus::DependencyGraph Class Reference

Dependency graph for component execution ordering. More...

#include <TopologyAnalyzer.hpp>

Public Member Functions

void AddEdge (const std::string &producer, const std::string &consumer, const std::string &signal_name="")
 Add a dependency edge: producer must execute before consumer.
void AddNode (const std::string &component)
 Add a node without any edges.
std::vector< std::string > GetNodes () const
 Get all nodes in the graph.
TopologyResult TopologicalSort () const
 Perform topological sort using Kahn's algorithm.
std::vector< CycleInfoDetectCycles () const
 Detect cycles using DFS.
size_t Size () const
 Get number of nodes.
bool Empty () const
 Check if graph is empty.
std::vector< std::string > GetDependents (const std::string &component) const
 Get dependents of a component (what runs after it).
std::vector< std::string > GetDependencies (const std::string &component) const
 Get dependencies of a component (what runs before it).

Detailed Description

Dependency graph for component execution ordering.

Builds a directed graph where:

  • Nodes = Components
  • Edges = Signal dependencies (A -> B means A must run before B)

Supports topological sorting with cycle detection.

Member Function Documentation

◆ AddEdge()

void icarus::DependencyGraph::AddEdge ( const std::string & producer,
const std::string & consumer,
const std::string & signal_name = "" )
inline

Add a dependency edge: producer must execute before consumer.

Parameters
producerComponent that produces the signal
consumerComponent that consumes the signal
signal_nameSignal connecting them (for diagnostics)

◆ AddNode()

void icarus::DependencyGraph::AddNode ( const std::string & component)
inline

Add a node without any edges.

Ensures components with no dependencies are included in the graph.

Parameters
componentComponent name

◆ DetectCycles()

std::vector< CycleInfo > icarus::DependencyGraph::DetectCycles ( ) const
inlinenodiscard

Detect cycles using DFS.

Returns
List of cycles found in the graph

◆ Empty()

bool icarus::DependencyGraph::Empty ( ) const
inlinenodiscard

Check if graph is empty.

◆ GetDependencies()

std::vector< std::string > icarus::DependencyGraph::GetDependencies ( const std::string & component) const
inlinenodiscard

Get dependencies of a component (what runs before it).

◆ GetDependents()

std::vector< std::string > icarus::DependencyGraph::GetDependents ( const std::string & component) const
inlinenodiscard

Get dependents of a component (what runs after it).

◆ GetNodes()

std::vector< std::string > icarus::DependencyGraph::GetNodes ( ) const
inlinenodiscard

Get all nodes in the graph.

◆ Size()

size_t icarus::DependencyGraph::Size ( ) const
inlinenodiscard

Get number of nodes.

◆ TopologicalSort()

TopologyResult icarus::DependencyGraph::TopologicalSort ( ) const
inlinenodiscard

Perform topological sort using Kahn's algorithm.

Returns
TopologyResult with execution order and cycle info

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