pub struct AdjacencyListGraph {
pub vsize: usize,
pub esize: usize,
pub graph: Vec<Vec<Neighbor<usize, usize>>>,
}Fields§
§vsize: usize§esize: usize§graph: Vec<Vec<Neighbor<usize, usize>>>Implementations§
Source§impl AdjacencyListGraph
impl AdjacencyListGraph
Sourcepub fn new(vsize: usize) -> AdjacencyListGraph
pub fn new(vsize: usize) -> AdjacencyListGraph
Examples found in repository?
crates/competitive/src/graph/adjacency_list.rs (line 123)
122 fn mscan<I: ScanSource>(self, iter: &mut I) -> Option<Self::Output> {
123 let mut graph = AdjacencyListGraph::new(self.vsize);
124 let mut rest = Vec::with_capacity(self.esize);
125 for _ in 0..self.esize {
126 let (from, to) = (U::scan(iter)?, U::scan(iter)?);
127 if self.directed {
128 graph.add_edge(from, to);
129 } else {
130 graph.add_undirected_edge(from, to);
131 }
132 rest.push(T::scan(iter)?);
133 }
134 Some((graph, rest))
135 }Sourcepub fn add_edge(&mut self, from: usize, to: usize)
pub fn add_edge(&mut self, from: usize, to: usize)
Examples found in repository?
crates/competitive/src/graph/adjacency_list.rs (line 128)
122 fn mscan<I: ScanSource>(self, iter: &mut I) -> Option<Self::Output> {
123 let mut graph = AdjacencyListGraph::new(self.vsize);
124 let mut rest = Vec::with_capacity(self.esize);
125 for _ in 0..self.esize {
126 let (from, to) = (U::scan(iter)?, U::scan(iter)?);
127 if self.directed {
128 graph.add_edge(from, to);
129 } else {
130 graph.add_undirected_edge(from, to);
131 }
132 rest.push(T::scan(iter)?);
133 }
134 Some((graph, rest))
135 }Sourcepub fn add_undirected_edge(&mut self, u: usize, v: usize)
pub fn add_undirected_edge(&mut self, u: usize, v: usize)
Examples found in repository?
crates/competitive/src/graph/adjacency_list.rs (line 130)
122 fn mscan<I: ScanSource>(self, iter: &mut I) -> Option<Self::Output> {
123 let mut graph = AdjacencyListGraph::new(self.vsize);
124 let mut rest = Vec::with_capacity(self.esize);
125 for _ in 0..self.esize {
126 let (from, to) = (U::scan(iter)?, U::scan(iter)?);
127 if self.directed {
128 graph.add_edge(from, to);
129 } else {
130 graph.add_undirected_edge(from, to);
131 }
132 rest.push(T::scan(iter)?);
133 }
134 Some((graph, rest))
135 }pub fn vertices(&self) -> Range<usize> ⓘ
Trait Implementations§
Source§impl Clone for AdjacencyListGraph
impl Clone for AdjacencyListGraph
Source§impl Debug for AdjacencyListGraph
impl Debug for AdjacencyListGraph
Source§impl Default for AdjacencyListGraph
impl Default for AdjacencyListGraph
Source§impl<T> EdgeMap<T> for AdjacencyListGraph
impl<T> EdgeMap<T> for AdjacencyListGraph
type Emap = Vec<T>
fn construct_emap<F>(&self, f: F) -> Self::Emapwhere
F: FnMut() -> T,
fn emap_get<'a>(&self, map: &'a Self::Emap, eid: Self::Label) -> &'a T
fn emap_get_mut<'a>( &self, map: &'a mut Self::Emap, eid: Self::Label, ) -> &'a mut T
fn emap_set(&self, map: &mut Self::Emap, eid: Self::Label, value: T)
Source§impl Graph for AdjacencyListGraph
impl Graph for AdjacencyListGraph
type Vertex = usize
type Label = usize
type Vertices<'g> = Range<usize>
type Neighbors<'g> = Copied<Iter<'g, Neighbor<usize, usize>>>
fn vsize(&self) -> usize
fn vertices(&self) -> Self::Vertices<'_>
fn neighbors(&self, vertex: Self::Vertex) -> Self::Neighbors<'_>
Source§impl<T> VertexMap<T> for AdjacencyListGraph
impl<T> VertexMap<T> for AdjacencyListGraph
type Vmap = Vec<T>
fn construct_vmap<F>(&self, f: F) -> Self::Vmapwhere
F: FnMut() -> T,
fn vmap_get<'a>(&self, map: &'a Self::Vmap, vertex: Self::Vertex) -> &'a T
fn vmap_get_mut<'a>( &self, map: &'a mut Self::Vmap, vertex: Self::Vertex, ) -> &'a mut T
fn vmap_set(&self, map: &mut Self::Vmap, vertex: Self::Vertex, value: T)
Auto Trait Implementations§
impl Freeze for AdjacencyListGraph
impl RefUnwindSafe for AdjacencyListGraph
impl Send for AdjacencyListGraph
impl Sync for AdjacencyListGraph
impl Unpin for AdjacencyListGraph
impl UnsafeUnpin for AdjacencyListGraph
impl UnwindSafe for AdjacencyListGraph
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