pub type TabMor<V, E> = Path<TabOb<V, E>, TabEdge<V, E>>;
Expand description
Morphism in a model of a discrete tabulator theory.
Aliased Type§
enum TabMor<V, E> {
Id(TabOb<V, E>),
Seq(NonEmpty<TabEdge<V, E>>),
}
Variants§
Id(TabOb<V, E>)
The identity, or empty, path at a vertex.
Seq(NonEmpty<TabEdge<V, E>>)
A nontrivial path, comprising a non-empty vector of consecutive edges.
Implementations
Source§impl<V, E> Path<V, E>
impl<V, E> Path<V, E>
Sourcepub fn collect<I>(iter: I) -> Option<Self>where
I: IntoIterator<Item = E>,
pub fn collect<I>(iter: I) -> Option<Self>where
I: IntoIterator<Item = E>,
Constructs a path from an iterator over edges.
Returns None
if the iterator is empty.
Sourcepub fn from_vec(vec: Vec<E>) -> Option<Self>
pub fn from_vec(vec: Vec<E>) -> Option<Self>
Constructs a path from a vector of edges.
Returns None
if the vector is empty.
Sourcepub fn repeat_n(v: V, e: E, n: usize) -> Selfwhere
E: Clone,
pub fn repeat_n(v: V, e: E, n: usize) -> Selfwhere
E: Clone,
Constructs a path by repeating an edge n
times.
The edge should have the same source and target, namely the first argument.
Sourcepub fn iter(&self) -> impl Iterator<Item = &E>
pub fn iter(&self) -> impl Iterator<Item = &E>
Iterates over edges in the path, if any.
This method is a one-sided inverse to Path::collect
.
Sourcepub fn only(self) -> Option<E>
pub fn only(self) -> Option<E>
Returns the unique edge in a path of length 1.
This method is a one-sided inverse to Path::single
.
Sourcepub fn insert(&mut self, index: usize, edge: E)
pub fn insert(&mut self, index: usize, edge: E)
Inserts an edge into the path at the given index.
Sourcepub fn splice(self, range: Range<usize>, replace_with: Self) -> Self
pub fn splice(self, range: Range<usize>, replace_with: Self) -> Self
Splices a path into another path at the given range of indices.
Sourcepub fn src(&self, graph: &impl Graph<V = V, E = E>) -> Vwhere
V: Clone,
pub fn src(&self, graph: &impl Graph<V = V, E = E>) -> Vwhere
V: Clone,
Source of the path in the given graph.
Assumes that the path is contained in the graph.
Sourcepub fn tgt(&self, graph: &impl Graph<V = V, E = E>) -> Vwhere
V: Clone,
pub fn tgt(&self, graph: &impl Graph<V = V, E = E>) -> Vwhere
V: Clone,
Target of the path in the given graph.
Assumes that the path is contained in the graph.
Sourcepub fn subpath(
&self,
graph: &impl Graph<V = V, E = E>,
range: Range<usize>,
) -> Self
pub fn subpath( &self, graph: &impl Graph<V = V, E = E>, range: Range<usize>, ) -> Self
Extracts a subpath of a path in a graph.
Panics if the range is invalid or an empty subpath would be inconsistent.
Sourcepub fn replace_subpath<F>(
self,
graph: &impl Graph<V = V, E = E>,
range: Range<usize>,
f: F,
) -> Self
pub fn replace_subpath<F>( self, graph: &impl Graph<V = V, E = E>, range: Range<usize>, f: F, ) -> Self
Replaces the subpath at the given range with a function of that subpath.
Panics under the same conditions as subpath
.
Sourcepub fn concat_in(
self,
graph: &impl Graph<V = V, E = E>,
other: Self,
) -> Option<Self>
pub fn concat_in( self, graph: &impl Graph<V = V, E = E>, other: Self, ) -> Option<Self>
Concatenates this path with another path in the graph.
This methods checks that the two paths are compatible (the target of this
path equals the source of the other path) and it assumes that both paths
are contained in the graph, which should be checked with
contained_in
if in doubt. Thus, when returned, the
concatenated path is also a valid path.
Sourcepub fn contained_in(&self, graph: &impl Graph<V = V, E = E>) -> boolwhere
V: Eq,
pub fn contained_in(&self, graph: &impl Graph<V = V, E = E>) -> boolwhere
V: Eq,
Is the path contained in the given graph?
Sourcepub fn is_simple(&self) -> bool
pub fn is_simple(&self) -> bool
Returns whether the path is simple.
On our definition, a path is simple if it has no repeated edges.
Sourcepub fn reduce<FnV, FnE>(self, fv: FnV, fe: FnE) -> E
pub fn reduce<FnV, FnE>(self, fv: FnV, fe: FnE) -> E
Reduces a path using functions on vertices and edges.
Sourcepub fn map<CodV, CodE, FnV, FnE>(self, fv: FnV, fe: FnE) -> Path<CodV, CodE>
pub fn map<CodV, CodE, FnV, FnE>(self, fv: FnV, fe: FnE) -> Path<CodV, CodE>
Maps a path over functions on vertices and edges.
Sourcepub fn partial_map<CodV, CodE, FnV, FnE>(
self,
fv: FnV,
fe: FnE,
) -> Option<Path<CodV, CodE>>
pub fn partial_map<CodV, CodE, FnV, FnE>( self, fv: FnV, fe: FnE, ) -> Option<Path<CodV, CodE>>
Maps a path over partial functions on vertices and edges.
Trait Implementations§
Source§impl<'de, V, E> Deserialize<'de> for Path<V, E>where
V: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, V, E> Deserialize<'de> for Path<V, E>where
V: Deserialize<'de>,
E: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<V, E> FromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
impl<V, E> FromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
Source§impl<V, E> IntoIterator for Path<V, E>
Converts the path into an iterater over its edges.
impl<V, E> IntoIterator for Path<V, E>
Converts the path into an iterater over its edges.
Source§impl<V, E> IntoWasmAbi for Path<V, E>
impl<V, E> IntoWasmAbi for Path<V, E>
Source§impl<V, E> OptionFromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
impl<V, E> OptionFromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
Source§impl<V, E> OptionIntoWasmAbi for Path<V, E>
impl<V, E> OptionIntoWasmAbi for Path<V, E>
Source§impl<V, E> RefFromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
impl<V, E> RefFromWasmAbi for Path<V, E>where
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self
are recovered from.