Table of Contents

Class GraphExecutor

Namespace
FlowGraph.Core.DataFlow
Assembly
FlowGraph.Core.dll

Executes a graph by propagating data through connected nodes. Uses topological sorting for correct execution order. Optimized for incremental updates - only re-executes affected nodes. Thread-safe for concurrent access from multiple threads.

public sealed class GraphExecutor : IDisposable
Inheritance
GraphExecutor
Implements
Inherited Members

Constructors

GraphExecutor(Graph)

Creates a new graph executor.

public GraphExecutor(Graph graph)

Parameters

graph Graph

The graph to execute.

Properties

Processors

Gets all registered processors.

public IReadOnlyDictionary<string, INodeProcessor> Processors { get; }

Property Value

IReadOnlyDictionary<string, INodeProcessor>

Methods

BeginBatchUpdate()

Begins a batch update. Changes won't propagate until EndBatchUpdate is called. Use this when making multiple changes to prevent intermediate executions.

public void BeginBatchUpdate()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

EndBatchUpdate()

Ends batch update and executes all dirty nodes.

public void EndBatchUpdate()

ExecuteAll()

Executes the entire graph in topological order.

public void ExecuteAll()

ExecuteFrom(string)

Executes only nodes affected by a change to the specified node. More efficient than ExecuteAll when only one input changed.

public void ExecuteFrom(string nodeId)

Parameters

nodeId string

The node that changed.

GetProcessor(string)

Gets a processor by node ID.

public INodeProcessor? GetProcessor(string nodeId)

Parameters

nodeId string

The node ID.

Returns

INodeProcessor

The processor, or null if not found.

GetProcessor<T>(string)

Gets a typed processor by node ID.

public T? GetProcessor<T>(string nodeId) where T : class, INodeProcessor

Parameters

nodeId string

The node ID.

Returns

T

The processor, or null if not found or wrong type.

Type Parameters

T

The processor type.

PropagateFromPort(string, string)

Propagates the current value from a source port to all connected target ports.

public void PropagateFromPort(string sourceNodeId, string sourcePortId)

Parameters

sourceNodeId string

The source node ID.

sourcePortId string

The source port ID.

RegisterProcessor(INodeProcessor)

Registers a processor for a node.

public void RegisterProcessor(INodeProcessor processor)

Parameters

processor INodeProcessor

The processor to register.

UnregisterProcessor(string)

Unregisters a processor.

public bool UnregisterProcessor(string nodeId)

Parameters

nodeId string

The node ID to unregister.

Returns

bool

True if the processor was found and removed.

Events

ExecutionCompleted

Event raised when execution completes.

public event EventHandler? ExecutionCompleted

Event Type

EventHandler

ExecutionStarted

Event raised when execution starts.

public event EventHandler? ExecutionStarted

Event Type

EventHandler

NodeProcessed

Event raised when a node is processed.

public event EventHandler<NodeProcessedEventArgs>? NodeProcessed

Event Type

EventHandler<NodeProcessedEventArgs>