radial sugiyama positioning integration

This commit is contained in:
Oxy8
2026-03-23 11:13:27 -03:00
parent 6b9115e43b
commit 696844f341
51 changed files with 10089 additions and 364 deletions

View File

@@ -0,0 +1,70 @@
use std::error::Error;
use std::fmt::{Display, Formatter};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum LayoutError {
InvalidNodeIndex {
edge_index: usize,
node_index: usize,
node_count: usize,
},
SelfLoop {
edge_index: usize,
node: usize,
},
DuplicateEdge {
edge_index: usize,
source: usize,
target: usize,
},
CycleDetected,
InvalidHierarchyEdge {
edge_index: usize,
source: usize,
target: usize,
source_level: usize,
target_level: usize,
},
}
impl Display for LayoutError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
LayoutError::InvalidNodeIndex {
edge_index,
node_index,
node_count,
} => write!(
f,
"edge {} references node {} but graph only has {} nodes",
edge_index, node_index, node_count
),
LayoutError::SelfLoop { edge_index, node } => {
write!(f, "edge {} is a self-loop on node {}", edge_index, node)
}
LayoutError::DuplicateEdge {
edge_index,
source,
target,
} => write!(
f,
"edge {} duplicates existing directed edge {} -> {}",
edge_index, source, target
),
LayoutError::CycleDetected => write!(f, "graph must be a directed acyclic graph"),
LayoutError::InvalidHierarchyEdge {
edge_index,
source,
target,
source_level,
target_level,
} => write!(
f,
"edge {} ({} -> {}) violates hierarchy levels {} -> {}",
edge_index, source, target, source_level, target_level
),
}
}
}
impl Error for LayoutError {}