pub type Result<T, E = GraphOperationError> = std::result::Result<T, E>;
#[derive(thiserror::Error, Debug, Eq, PartialEq)]
pub enum GraphOperationError {
#[error("this vertex_id already exists in the graph")]
VertexAlreadyExists,
#[error("this vertex_id does not exist in the graph")]
VertexDoesNotExist,
#[error("unable to find edge in graph between two vertices")]
EdgeDoesNotExist,
}
#[derive(thiserror::Error, Debug, Eq, PartialEq)]
pub enum ParseGraphError {
#[error("incorrect vertex definition at line {0}")]
VertexDefinition(usize),
#[error("incorrect edge definition at line {0}")]
EdgeDefinition(usize),
#[error("vertex with index {0} already defined, check line {1}")]
VertexAlreadyDefined(usize, usize),
#[error("failed to join vertices with ids {0}, {1} because they are not defined at line {2}")]
VerticesNotDefined(usize, usize, usize),
#[error("failed to parse index of the vertex or edge at line {0}")]
ParseInt(usize),
#[error("failed to parse label data of the vertex or edge at line {0}")]
ParseLabel(usize),
#[error("some graph operation failed: {0} at line {1}")]
GraphError(GraphOperationError, usize),
}