pub struct Graph { /* private fields */ }Expand description
A graph with numbered edges (edge e carries spin e) and colored half-edges.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn new(ends: &[(usize, usize)], colors: &[Vec<usize>]) -> Self
pub fn new(ends: &[(usize, usize)], colors: &[Vec<usize>]) -> Self
From the colored neighbourhoods: colors[x][c] is the edge of color c at node x, and
ends[e] the two nodes of edge e (they may coincide only for distinct edges, as in a
two-node cycle). Every edge must appear exactly once at each of its ends.
Sourcepub fn from_edges(nodes: usize, ends: &[(usize, usize)]) -> Self
pub fn from_edges(nodes: usize, ends: &[(usize, usize)]) -> Self
Edges in the order given; the colors of each node follow the order in which its edges appear in the list.
Sourcepub fn cycle(n: usize) -> Self
pub fn cycle(n: usize) -> Self
Ring of n ≥ 2 nodes, as in Sellapillay & Verga: edge x joins x and x + 1, color 0
of node x points to x + 1 and color 1 to x − 1.
Sourcepub fn path(n: usize) -> Self
pub fn path(n: usize) -> Self
Chain of n ≥ 2 nodes: edge x joins x and x + 1; color 0 points to x + 1 and
color 1 to x − 1 (the end nodes have one color).
Sourcepub fn half_edges(&self) -> usize
pub fn half_edges(&self) -> usize
Number of half-edges, 2|E|.
Sourcepub fn max_degree(&self) -> usize
pub fn max_degree(&self) -> usize
Largest degree.
Sourcepub fn half_edges_of(&self, x: usize) -> Range<usize>
pub fn half_edges_of(&self, x: usize) -> Range<usize>
Half-edges of node x, in color order.
Sourcepub fn node_and_color(&self, h: usize) -> (usize, usize)
pub fn node_and_color(&self, h: usize) -> (usize, usize)
Node and color of half-edge h.
Trait Implementations§
impl Eq for Graph
impl StructuralPartialEq for Graph
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
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>
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>
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