Skip to main content

merman_elk_layered/
lib.rs

1//! Source-backed Eclipse ELK layered port.
2//!
3//! This module mirrors the structure of Eclipse ELK instead of the old compatibility backend:
4//! - https://github.com/eclipse-elk/elk/blob/62d5909f96fad541bc101ad52dabaece6b7eab7e/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/LayeredPhases.java
5//! - https://github.com/eclipse-elk/elk/blob/62d5909f96fad541bc101ad52dabaece6b7eab7e/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/GraphConfigurator.java
6//! - https://github.com/eclipse-elk/elk/blob/62d5909f96fad541bc101ad52dabaece6b7eab7e/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/intermediate/IntermediateProcessorStrategy.java
7//! - https://github.com/eclipse-elk/elk/tree/62d5909f96fad541bc101ad52dabaece6b7eab7e/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/graph
8
9pub mod algorithms;
10mod common;
11mod components;
12mod compound;
13mod configurator;
14mod graph;
15mod importer;
16mod intermediate;
17mod options;
18mod p1cycles;
19mod p2layers;
20mod p3order;
21mod p4nodes;
22mod p5edges;
23mod pipeline;
24mod random;
25mod selfloops;
26mod transform;
27mod work;
28
29// The source-port graph and phase implementations are deliberately private. A raw `LGraph`
30// may carry ELK's `randomSeed = 0` sentinel, so only public pipeline entry points are allowed to
31// execute it: they configure the graph first and either fail closed or resolve it from an
32// operation-owned seed. Keep phase helpers crate-private even when they are useful for parity
33// work; diagnostics must go through the guarded pipeline APIs below.
34pub use common::networksimplex::NetworkSimplexError;
35pub use common::nodespacing::inside_top_center_micro_layout;
36pub use components::ComponentError;
37pub use configurator::{LayeredSpacings, configure_graph_properties, configured_options};
38pub use graph::{
39    CompoundEdgeSegment, CrossHierarchyEdge, EdgeLabelPlacement, GraphProperties, LGraph, LLabel,
40    LMargin, LNode, LNodeKind, LPadding, LPoint, LPort, LSize, LabelSide, Layer, LayeredEdge,
41    PortRef, PortSide, PortType, SelfHyperLoop, SelfHyperLoopLabels, SelfLoopEdge, SelfLoopHolder,
42    SelfLoopLabelAlignment, SelfLoopLabelRef, SelfLoopPort, SelfLoopType,
43};
44pub use importer::{
45    ElkInputEdge, ElkInputEdgeSegment, ElkInputEdgeSegmentEndpoint, ElkInputGraph, ElkInputLabel,
46    ElkInputNode, ImportError, ImportResult, import_graph,
47    import_graph_at_scope_and_segments_with_work_control,
48    import_graph_at_seed_scope_and_segments_with_work_control, import_graph_with_operation_seed,
49    import_graph_with_operation_seed_and_work_control, import_graph_with_operation_seed_at_scope,
50    import_graph_with_operation_seed_at_scope_and_segments_with_work_control,
51    import_graph_with_operation_seed_at_seed_scope_and_segments_with_work_control,
52    import_graph_with_work_control,
53};
54pub use intermediate::IntermediateError;
55pub use options::{
56    Alignment, ContentAlignment, CrossingMinimizationStrategy, CycleBreakingStrategy,
57    DirectionCongruency, EdgeLabelSideSelection, EdgeRouting, ElkDirection, ElkPadding,
58    FixedAlignment, GreedySwitchType, HierarchyHandling, LayerConstraint, LayeredOptions,
59    LayeringStrategy, LongEdgeOrderingStrategy, NodeFlexibility, NodeLabelPlacement,
60    NodePlacementStrategy, NodeSizeError, OrderingStrategy, PortAlignment, PortConstraints,
61    PortSortingStrategy, SelfLoopDistributionStrategy, SelfLoopOrderingStrategy, SpacingMargin,
62    SpacingOptions,
63};
64pub use p2layers::LayeringError;
65pub use p3order::sweep::{HierarchySweepDebugTrace, HierarchySweepNodeDebug};
66pub use pipeline::{
67    GraphExecution, LayeredPhase, PipelineError, PipelineResult, ProcessorKind, ProcessorSlot,
68    assemble_processors, assemble_processors_for_graph, execute_ported_compound_processors,
69    execute_ported_compound_processors_until, execute_ported_compound_processors_until_processor,
70    execute_ported_compound_processors_until_processor_with_work_control,
71    execute_ported_compound_processors_until_with_work_control,
72    execute_ported_compound_processors_with_work_control, execute_ported_processors,
73    execute_ported_processors_with_work_control, execute_processors_until,
74    execute_processors_until_processor, execute_processors_until_processor_with_work_control,
75    execute_processors_until_with_work_control, inspect_compound_crossings_after_processor,
76    inspect_compound_crossings_after_processor_with_work_control,
77};
78pub use random::{GraphSeedScope, OperationSeed, RandomSeedError};
79pub use work::{NoopWorkControl, WorkControl, WorkError};
80
81/// Phase implementations are intentionally not public. In particular, this must fail to compile:
82/// a raw graph has not crossed the fallible configuration boundary that resolves or rejects
83/// ELK's `randomSeed = 0` sentinel.
84///
85/// ```compile_fail
86/// use merman_elk_layered::{LGraph, LayeredOptions};
87///
88/// let mut graph = LGraph::new(
89///     "root",
90///     LayeredOptions {
91///         random_seed: 0,
92///         ..Default::default()
93///     },
94/// );
95/// merman_elk_layered::p1cycles::break_cycles_greedy(&mut graph);
96/// ```
97const _RAW_PHASES_ARE_NOT_PUBLIC: () = ();