StellaOps.ElkSharp
Layered layout of directed graphs: layer assignment, node ordering and placement, and edge routing. Lays out workflow diagrams.
| Package | StellaOps.ElkSharp |
| Component | Workflow |
| Licence | BUSL-1.1 (Workflow licence) |
| Package kind | Library |
| Target framework | net10.0 |
To add the package to a project, see Installing Stella Ops packages.
Namespaces
| Namespace | Types |
|---|---|
StellaOps.ElkSharp | 20 |
StellaOps.ElkSharp namespace
| Type | Kind | Description |
|---|---|---|
EdgeRefinementOptions | record | Settings of the pass that reroutes problem edges after the first routing. |
ElkEdge | record | An edge of a graph to lay out. |
ElkEdgeSection | record | A routed section of an edge. |
ElkGraph | record | A graph to lay out: nodes and edges. |
ElkLayoutDirection | enum | The direction of the layers. |
ElkLayoutEffort | enum | How hard the layout works on node order and placement. |
ElkLayoutOptions | record | Settings of an ElkSharp layered layout. |
ElkLayoutResult | record | A laid-out graph: positioned nodes and routed edges. |
ElkNode | record | A node of a graph to lay out. |
ElkPoint | record | A point of a laid-out graph. |
ElkPort | record | A port of a node to lay out. |
ElkPositionedNode | record | A positioned node. |
ElkPositionedPort | record | A positioned port. |
ElkRoutedEdge | record | A routed edge. |
ElkSharpLayeredLayoutEngine | class | The ElkSharp layered layout engine. |
ElkSharpSourceAnalyzer | class | Counts the constructs of a compiled ELK JavaScript source. |
ElkSharpSourceProfile | record | The construct counts of a compiled ELK JavaScript source. |
IElkLayoutEngine | interface | Lays out graphs. |
IterativeRoutingMode | enum | The strategy of the iterative edge routing. |
IterativeRoutingOptions | record | Settings of the iterative edge routing. |
EdgeRefinementOptions record
public sealed record EdgeRefinementOptions
Settings of the pass that reroutes problem edges after the first routing.
EdgeRefinementOptions() constructor
public EdgeRefinementOptions()
Creates an instance of EdgeRefinementOptions.
BaseObstacleMargin property
public double BaseObstacleMargin { get; init; }
The margin kept around nodes, at least 8 layout units. The default is 18.
Enabled property
public bool? Enabled { get; init; }
Whether edges are refined after routing; when not set, on with ElkLayoutEffort.Besteffort and off otherwise.
MaxGlobalPasses property
public int MaxGlobalPasses { get; init; }
The refinement passes over the whole graph; not negative. The default is 2.
MaxProblemEdgesPerPass property
public int MaxProblemEdgesPerPass { get; init; }
The problem edges refined in one pass, at least 1. The default is 12.
MaxTrialsPerProblemEdge property
public int MaxTrialsPerProblemEdge { get; init; }
The reroute trials per problem edge, at least 1. The default is 4.
SoftObstacleClearance property
public double SoftObstacleClearance { get; init; }
The clearance kept from soft obstacles, at least 8 layout units. The default is 14.
SoftObstacleWeight property
public double SoftObstacleWeight { get; init; }
The weight of soft obstacles in route costs; not negative. The default is 0.4.
ElkEdge record
public sealed record ElkEdge
An edge of a graph to lay out.
ElkEdge() constructor
public ElkEdge()
Creates an instance of ElkEdge.
Id property
public required string Id { get; init; }
The edge identifier.
Kind property
public string? Kind { get; init; }
The edge kind.
Label property
public string? Label { get; init; }
The label.
SourceNodeId property
public required string SourceNodeId { get; init; }
The source node.
SourcePortId property
public string? SourcePortId { get; init; }
The source port, when the edge leaves a port.
TargetNodeId property
public required string TargetNodeId { get; init; }
The target node.
TargetPortId property
public string? TargetPortId { get; init; }
The target port, when the edge enters a port.
ElkEdgeSection record
public sealed record ElkEdgeSection
A routed section of an edge.
ElkEdgeSection() constructor
public ElkEdgeSection()
Creates an instance of ElkEdgeSection.
BendPoints property
public IReadOnlyCollection<ElkPoint> BendPoints { get; init; }
The bends between them.
EndPoint property
public required ElkPoint EndPoint { get; init; }
Where the section ends.
StartPoint property
public required ElkPoint StartPoint { get; init; }
Where the section starts.
ElkGraph record
public sealed record ElkGraph
A graph to lay out: nodes and edges.
ElkGraph() constructor
public ElkGraph()
Creates an instance of ElkGraph.
Edges property
public required IReadOnlyCollection<ElkEdge> Edges { get; init; }
The edges.
Id property
public required string Id { get; init; }
The graph identifier.
Nodes property
public required IReadOnlyCollection<ElkNode> Nodes { get; init; }
The nodes.
ElkLayoutDirection enum
public enum ElkLayoutDirection
The direction of the layers.
| Value | Description |
|---|---|
TopToBottom = 0 | From top to bottom. |
LeftToRight = 1 | From left to right. |
ElkLayoutEffort enum
public enum ElkLayoutEffort
How hard the layout works on node order and placement.
ElkLayoutOptions record
public sealed record ElkLayoutOptions
Settings of an ElkSharp layered layout.
ElkLayoutOptions() constructor
public ElkLayoutOptions()
Creates an instance of ElkLayoutOptions.
CompoundHeaderHeight property
public double CompoundHeaderHeight { get; init; }
The height of a compound node’s header, in layout units. The default is 28.
CompoundPadding property
public double CompoundPadding { get; init; }
The padding inside a compound node, in layout units. The default is 30.
Direction property
public ElkLayoutDirection Direction { get; init; }
The direction of the layers. The default is ElkLayoutDirection.LeftToRight.
EdgeRefinement property
public EdgeRefinementOptions? EdgeRefinement { get; init; }
The edge refinement pass; the defaults apply when not set.
Effort property
public ElkLayoutEffort Effort { get; init; }
How much work the layout spends on quality. The default is ElkLayoutEffort.Best.
IterativeRouting property
public IterativeRoutingOptions? IterativeRouting { get; init; }
The iterative edge routing; the defaults apply when not set.
LayerSpacing property
public double LayerSpacing { get; init; }
The space between layers, in layout units. The default is 80.
NodeSpacing property
public double NodeSpacing { get; init; }
The space between nodes of one layer, in layout units. The default is 40.
OrderingIterations property
public int? OrderingIterations { get; init; }
The node ordering iterations, at least 2; when not set, derived from the graph size and the effort.
PlacementIterations property
public int? PlacementIterations { get; init; }
The node placement iterations, at least 1; when not set, derived from the graph size and the effort.
ElkLayoutResult record
public sealed record ElkLayoutResult
A laid-out graph: positioned nodes and routed edges.
ElkLayoutResult() constructor
public ElkLayoutResult()
Creates an instance of ElkLayoutResult.
Edges property
public required IReadOnlyCollection<ElkRoutedEdge> Edges { get; init; }
The routed edges.
GraphId property
public required string GraphId { get; init; }
The graph identifier.
Nodes property
public required IReadOnlyCollection<ElkPositionedNode> Nodes { get; init; }
The positioned nodes.
ElkNode record
public sealed record ElkNode
A node of a graph to lay out.
ElkNode() constructor
public ElkNode()
Creates an instance of ElkNode.
Height property
public double Height { get; init; }
The node height.
IconKey property
public string? IconKey { get; init; }
The icon of the node.
Id property
public required string Id { get; init; }
The node identifier.
Kind property
public required string Kind { get; init; }
The node kind.
Label property
public required string Label { get; init; }
The label.
ParentNodeId property
public string? ParentNodeId { get; init; }
The node that contains this one, when it is nested.
Ports property
public IReadOnlyCollection<ElkPort> Ports { get; init; }
The ports.
Route property
public string? Route { get; init; }
The route of a task node.
SemanticKey property
public string? SemanticKey { get; init; }
The name of what the node stands for.
SemanticType property
public string? SemanticType { get; init; }
What the node stands for.
TaskType property
public string? TaskType { get; init; }
The task type of a task node.
Width property
public double Width { get; init; }
The node width.
ElkPoint record
public sealed record ElkPoint
A point of a laid-out graph.
ElkPoint() constructor
public ElkPoint()
Creates an instance of ElkPoint.
X property
public required double X { get; init; }
The horizontal position.
Y property
public required double Y { get; init; }
The vertical position.
ElkPort record
public sealed record ElkPort
A port of a node to lay out.
ElkPort() constructor
public ElkPort()
Creates an instance of ElkPort.
Height property
public double Height { get; init; }
The port height.
Id property
public required string Id { get; init; }
The port identifier.
Side property
public string? Side { get; init; }
The side of the node the port is on.
Width property
public double Width { get; init; }
The port width.
ElkPositionedNode record
public sealed record ElkPositionedNode
A positioned node.
ElkPositionedNode() constructor
public ElkPositionedNode()
Creates an instance of ElkPositionedNode.
Height property
public double Height { get; init; }
The node height.
IconKey property
public string? IconKey { get; init; }
The icon of the node.
Id property
public required string Id { get; init; }
The node identifier.
Kind property
public required string Kind { get; init; }
The node kind.
Label property
public required string Label { get; init; }
The label.
ParentNodeId property
public string? ParentNodeId { get; init; }
The node that contains this one, when it is nested.
Ports property
public IReadOnlyCollection<ElkPositionedPort> Ports { get; init; }
The positioned ports.
Route property
public string? Route { get; init; }
The route of a task node.
SemanticKey property
public string? SemanticKey { get; init; }
The name of what the node stands for.
SemanticType property
public string? SemanticType { get; init; }
What the node stands for.
TaskType property
public string? TaskType { get; init; }
The task type of a task node.
Width property
public double Width { get; init; }
The node width.
X property
public double X { get; init; }
The left edge of the node.
Y property
public double Y { get; init; }
The top edge of the node.
ElkPositionedPort record
public sealed record ElkPositionedPort
A positioned port.
ElkPositionedPort() constructor
public ElkPositionedPort()
Creates an instance of ElkPositionedPort.
Height property
public double Height { get; init; }
The port height.
Id property
public required string Id { get; init; }
The port identifier.
Side property
public string? Side { get; init; }
The side of the node the port is on.
Width property
public double Width { get; init; }
The port width.
X property
public double X { get; init; }
The left edge of the port.
Y property
public double Y { get; init; }
The top edge of the port.
ElkRoutedEdge record
public sealed record ElkRoutedEdge
A routed edge.
ElkRoutedEdge() constructor
public ElkRoutedEdge()
Creates an instance of ElkRoutedEdge.
Id property
public required string Id { get; init; }
The edge identifier.
Kind property
public string? Kind { get; init; }
The edge kind.
Label property
public string? Label { get; init; }
The label.
Sections property
public IReadOnlyCollection<ElkEdgeSection> Sections { get; init; }
The routed sections.
SourceNodeId property
public required string SourceNodeId { get; init; }
The source node.
SourcePortId property
public string? SourcePortId { get; init; }
The source port, when the edge leaves a port.
TargetNodeId property
public required string TargetNodeId { get; init; }
The target node.
TargetPortId property
public string? TargetPortId { get; init; }
The target port, when the edge enters a port.
ElkSharpLayeredLayoutEngine class
public sealed class ElkSharpLayeredLayoutEngine : IElkLayoutEngine
The ElkSharp layered layout engine.
ElkSharpLayeredLayoutEngine() constructor
public ElkSharpLayeredLayoutEngine()
Creates an instance of ElkSharpLayeredLayoutEngine.
LayoutAsync(ElkGraph, ElkLayoutOptions, CancellationToken) method
public Task<ElkLayoutResult> LayoutAsync(ElkGraph graph, ElkLayoutOptions? options = null, CancellationToken cancellationToken = default)
Lays out a graph.
Parameters
graph: The graph.options: The layout options; the defaults when not set.cancellationToken: Cancels the layout.
Returns
The positioned nodes and routed edges.
ElkSharpSourceAnalyzer class
public static class ElkSharpSourceAnalyzer
Counts the constructs of a compiled ELK JavaScript source.
Analyze(string, string) method
public static ElkSharpSourceProfile Analyze(string sourceName, string sourceText)
Profiles source text.
Parameters
sourceName: The source name.sourceText: The source text.
Returns
The profile.
AnalyzeFileAsync(string, CancellationToken) method
public static Task<ElkSharpSourceProfile> AnalyzeFileAsync(string path, CancellationToken cancellationToken = default)
Profiles a source file.
Parameters
path: The file.cancellationToken: Cancels the read.
Returns
The profile.
ElkSharpSourceProfile record
public sealed record ElkSharpSourceProfile
The construct counts of a compiled ELK JavaScript source.
ElkSharpSourceProfile() constructor
public ElkSharpSourceProfile()
Creates an instance of ElkSharpSourceProfile.
CharacterCount property
public int CharacterCount { get; init; }
The characters.
CreateForClassCount property
public int CreateForClassCount { get; init; }
The createForClass calls.
DefineClassCount property
public int DefineClassCount { get; init; }
The defineClass calls.
FunctionCount property
public int FunctionCount { get; init; }
The function declarations.
InternConstantCount property
public int InternConstantCount { get; init; }
The $intern_ constants.
LayoutCommandCount property
public int LayoutCommandCount { get; init; }
The layout commands.
LineCount property
public int LineCount { get; init; }
The lines.
RegisterAlgorithmCount property
public int RegisterAlgorithmCount { get; init; }
The registerLayoutAlgorithms calls.
SourceName property
public required string SourceName { get; init; }
The source name.
IElkLayoutEngine interface
public interface IElkLayoutEngine
Lays out graphs.
LayoutAsync(ElkGraph, ElkLayoutOptions, CancellationToken) method
Task<ElkLayoutResult> LayoutAsync(ElkGraph graph, ElkLayoutOptions? options = null, CancellationToken cancellationToken = default)
Lays out a graph.
Parameters
graph: The graph.options: The layout options; the defaults when not set.cancellationToken: Cancels the layout.
Returns
The positioned nodes and routed edges.
IterativeRoutingMode enum
public enum IterativeRoutingMode
The strategy of the iterative edge routing.
| Value | Description |
|---|---|
LegacyMultiStrategy = 0 | The multi-strategy routing, the default. |
HybridDeterministic = 1 | The deterministic hybrid routing. |
IterativeRoutingOptions record
public sealed record IterativeRoutingOptions
Settings of the iterative edge routing.
IterativeRoutingOptions() constructor
public IterativeRoutingOptions()
Creates an instance of IterativeRoutingOptions.
Enabled property
public bool? Enabled { get; init; }
Whether edges are routed iteratively; when not set, on with ElkLayoutEffort.Besteffort and off otherwise.
MaxAdaptationsPerStrategy property
public int MaxAdaptationsPerStrategy { get; init; }
The adaptations tried per strategy, from 1 to 100. The default is 100.
MaxParallelRepairBuilds property
public int MaxParallelRepairBuilds { get; init; }
The repair builds that run in parallel, from 1 to the processor count. The default is 4.
MaxRepairWaves property
public int MaxRepairWaves { get; init; }
The repair waves, from 1 to 12. The default is 4.
Mode property
public IterativeRoutingMode Mode { get; init; }
The iterative routing strategy. The default is IterativeRoutingMode.LegacyMultiStrategy.
RequiredValidSolutions property
public int RequiredValidSolutions { get; init; }
The valid-solution budget of the iterative router, at least 1. The default is 10.
