pub struct Graph<N, H, E>{ /* private fields */ }Expand description
A graph suitable for canonical labelling.
N — vertex data (participates in comparison, determines initial colour).
H — vertex hidden data (does not affect the canonical form; used to
store e.g. the original slot position of a tensor).
E — edge data (participates in comparison).
Implementations§
Source§impl<N, H, E> Graph<N, H, E>
impl<N, H, E> Graph<N, H, E>
Sourcepub fn add_node(&mut self, data: N, hidden: H) -> usize
pub fn add_node(&mut self, data: N, hidden: H) -> usize
Add a vertex with the given data and hidden payload. Returns the new vertex index.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of vertices.
Vertex hidden payload.
Sourcepub fn add_directed_edge(&mut self, from: usize, to: usize, data: E)
pub fn add_directed_edge(&mut self, from: usize, to: usize, data: E)
Add a directed edge from → to with the given data.
Sourcepub fn add_undirected_edge(&mut self, u: usize, v: usize, data: E)
pub fn add_undirected_edge(&mut self, u: usize, v: usize, data: E)
Add an undirected edge between u and v with the given data.
Sourcepub fn edges_of(&self, v: usize) -> EdgeIter<'_, N, H, E> ⓘ
pub fn edges_of(&self, v: usize) -> EdgeIter<'_, N, H, E> ⓘ
Iterate edges incident to vertex v.
Each yielded item is (edge_index, neighbour_vertex, edge_data, is_directed, is_outgoing).
Sourcepub fn canonize(&self) -> CanonicalForm<N, H, E>
pub fn canonize(&self) -> CanonicalForm<N, H, E>
Compute the canonical labelling of this graph.
Trait Implementations§
Auto Trait Implementations§
impl<N, H, E> Freeze for Graph<N, H, E>
impl<N, H, E> RefUnwindSafe for Graph<N, H, E>
impl<N, H, E> Send for Graph<N, H, E>
impl<N, H, E> Sync for Graph<N, H, E>
impl<N, H, E> Unpin for Graph<N, H, E>
impl<N, H, E> UnsafeUnpin for Graph<N, H, E>
impl<N, H, E> UnwindSafe for Graph<N, H, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more