use crate::quiver::ArrowId;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum GentleError {
EmptyQuiver,
Loop { arrow: ArrowId, vertex: u32 },
MultipleEdges {
first: ArrowId,
second: ArrowId,
endpoints: (u32, u32),
},
Disconnected { vertices: usize, reachable: usize },
Cycle { vertices: usize, edges: usize },
NonMonomial { relation: usize, terms: usize },
NonQuadratic { relation: usize, length: usize },
IncomingDegree { vertex: u32, count: usize },
OutgoingDegree { vertex: u32, count: usize },
MultiplePermittedSuccessors { arrow: ArrowId, count: usize },
MultipleForbiddenSuccessors { arrow: ArrowId, count: usize },
MultiplePermittedPredecessors { arrow: ArrowId, count: usize },
MultipleForbiddenPredecessors { arrow: ArrowId, count: usize },
}
display_error! { error GentleError {
Self::EmptyQuiver => "the quiver has no vertices";
Self::Loop { arrow, vertex } => "arrow {} is a loop at vertex {vertex}", arrow.0;
Self::MultipleEdges { first, second, endpoints } => "arrows {} and {} are parallel on the undirected edge {} -- {}", first.0, second.0, endpoints.0, endpoints.1;
Self::Disconnected { vertices, reachable } => "the underlying graph reaches {reachable} of {vertices} vertices";
Self::Cycle { vertices, edges } => "the connected underlying graph has {edges} edges on {vertices} vertices, so it has a cycle";
Self::NonMonomial { relation, terms } => "reduced relation {relation} has {terms} terms; the gentle route needs a monomial ideal";
Self::NonQuadratic { relation, length } => "reduced relation {relation} has path length {length}; the gentle route needs quadratic relations";
Self::IncomingDegree { vertex, count } => "vertex {vertex} has {count} incoming arrows; a gentle quiver allows at most two";
Self::OutgoingDegree { vertex, count } => "vertex {vertex} has {count} outgoing arrows; a gentle quiver allows at most two";
Self::MultiplePermittedSuccessors { arrow, count } => "arrow {} has {count} permitted successors; a gentle quiver allows at most one", arrow.0;
Self::MultipleForbiddenSuccessors { arrow, count } => "arrow {} has {count} forbidden successors; a gentle quiver allows at most one", arrow.0;
Self::MultiplePermittedPredecessors { arrow, count } => "arrow {} has {count} permitted predecessors; a gentle quiver allows at most one", arrow.0;
Self::MultipleForbiddenPredecessors { arrow, count } => "arrow {} has {count} forbidden predecessors; a gentle quiver allows at most one", arrow.0;
} }