Table of Contents

Class EdgeDefinition

Namespace
FlowGraph.Core.Models
Assembly
FlowGraph.Core.dll

Immutable definition of an edge's identity and connection structure. Contains all properties that define "what" an edge connects, not its runtime state.

public sealed record EdgeDefinition : IEquatable<EdgeDefinition>
Inheritance
EdgeDefinition
Implements
Inherited Members

Remarks

This is a sealed record for value equality and immutability. Use with expressions to create modified copies:

var reconnected = definition with { Target = "newNodeId" };

Properties

AutoRoute

Whether this edge should use automatic routing to avoid obstacles.

public bool AutoRoute { get; init; }

Property Value

bool

Remarks

This property is maintained for backward compatibility. For new code, prefer using RoutingMode instead. When RoutingMode is explicitly set, it takes precedence.

EffectiveLabel

Gets the effective label text, preferring LabelInfo over Label.

public string? EffectiveLabel { get; }

Property Value

string

EffectiveRoutingMode

Gets the effective routing mode, considering both RoutingMode and legacy AutoRoute property.

public EdgeRoutingMode EffectiveRoutingMode { get; }

Property Value

EdgeRoutingMode

Remarks

If AutoRoute is true and RoutingMode is Auto, obstacle avoidance is enabled. Otherwise, RoutingMode determines behavior.

Id

Unique identifier for the edge. Required and immutable.

public required string Id { get; init; }

Property Value

string

IsLocked

Whether this edge is locked, preventing deletion and reconnection via UI.

public bool IsLocked { get; init; }

Property Value

bool

Remarks

When true, the edge cannot be deleted or reconnected through user interaction. Programmatic changes are still allowed. Useful for critical connections that should not be accidentally modified.

Label

Optional label to display on the edge.

public string? Label { get; init; }

Property Value

string

Remarks

For simple labels, use this property directly. For advanced positioning control, use LabelInfo instead. If both are set, LabelInfo takes precedence.

LabelInfo

Enhanced label with positioning information.

public LabelInfo? LabelInfo { get; init; }

Property Value

LabelInfo

Remarks

When set, this takes precedence over Label. Use EffectiveLabel to get the resolved label text regardless of which property was set.

MarkerEnd

The marker to display at the end of the edge.

public EdgeMarker MarkerEnd { get; init; }

Property Value

EdgeMarker

MarkerStart

The marker to display at the start of the edge.

public EdgeMarker MarkerStart { get; init; }

Property Value

EdgeMarker

RoutingMode

Determines how this edge's path is calculated.

public EdgeRoutingMode RoutingMode { get; init; }

Property Value

EdgeRoutingMode

Remarks

  • Auto - Router fully controls path (default)
  • Manual - Uses only user-defined waypoints
  • Guided - Router path passes through user waypoints

Source

The ID of the source node.

public required string Source { get; init; }

Property Value

string

SourcePort

The ID of the source port on the source node.

public required string SourcePort { get; init; }

Property Value

string

Style

Visual style for the edge including colors, dash patterns, and effects.

public EdgeStyle? Style { get; init; }

Property Value

EdgeStyle

Remarks

When null, the edge uses theme defaults. Set to customize individual edges or use preset styles like Success or Error.

Target

The ID of the target node.

public required string Target { get; init; }

Property Value

string

TargetPort

The ID of the target port on the target node.

public required string TargetPort { get; init; }

Property Value

string

Type

The visual type of the edge (bezier, straight, step, etc.).

public EdgeType Type { get; init; }

Property Value

EdgeType

Methods

ReconnectSource(string, string)

Creates a new definition with a different source node and port.

public EdgeDefinition ReconnectSource(string newSource, string newSourcePort)

Parameters

newSource string
newSourcePort string

Returns

EdgeDefinition

ReconnectTarget(string, string)

Creates a new definition with a different target node and port.

public EdgeDefinition ReconnectTarget(string newTarget, string newTargetPort)

Parameters

newTarget string
newTargetPort string

Returns

EdgeDefinition

WithLabel(string?)

Creates a new definition with a different label.

public EdgeDefinition WithLabel(string? label)

Parameters

label string

Returns

EdgeDefinition

WithLabelInfo(LabelInfo?)

Creates a new definition with enhanced label positioning.

public EdgeDefinition WithLabelInfo(LabelInfo? labelInfo)

Parameters

labelInfo LabelInfo

The label info with text and positioning.

Returns

EdgeDefinition

WithLabelInfo(string, LabelAnchor, double, double)

Creates a new definition with enhanced label positioning.

public EdgeDefinition WithLabelInfo(string text, LabelAnchor anchor = LabelAnchor.Center, double offsetX = 0, double offsetY = 0)

Parameters

text string

The label text.

anchor LabelAnchor

Where along the edge to position the label.

offsetX double

Horizontal offset from anchor point.

offsetY double

Vertical offset from anchor point.

Returns

EdgeDefinition

WithRoutingMode(EdgeRoutingMode)

Creates a new definition with a different routing mode.

public EdgeDefinition WithRoutingMode(EdgeRoutingMode mode)

Parameters

mode EdgeRoutingMode

Returns

EdgeDefinition

WithStyle(EdgeStyle?)

Creates a new definition with a different visual style.

public EdgeDefinition WithStyle(EdgeStyle? style)

Parameters

style EdgeStyle

Returns

EdgeDefinition

WithType(EdgeType)

Creates a new definition with a different edge type.

public EdgeDefinition WithType(EdgeType type)

Parameters

type EdgeType

Returns

EdgeDefinition