pub struct SimpleGraph {
pub vertices: Vec<VertexWithEdges>,
}Expand description
undirected, without loops or multiple edges
Fields§
§vertices: Vec<VertexWithEdges>Implementations§
Source§impl SimpleGraph
impl SimpleGraph
pub fn from_graph<G: Graph>(graph: &G) -> Self
pub fn add_vertex_with_index(&mut self, vertex: usize)
pub fn has_vertex(&self, vertex: usize) -> bool
pub fn first_vertex(&self) -> Option<&VertexWithEdges>
pub fn vertex(&self, index: usize) -> Option<&VertexWithEdges>
pub fn remove_vertex(&mut self, vertex: usize)
Trait Implementations§
Source§impl Clone for SimpleGraph
impl Clone for SimpleGraph
Source§fn clone(&self) -> SimpleGraph
fn clone(&self) -> SimpleGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimpleGraph
impl Debug for SimpleGraph
Source§impl Display for SimpleGraph
impl Display for SimpleGraph
Source§impl Graph for SimpleGraph
impl Graph for SimpleGraph
type V = VertexWithEdges
type E = UndirectedEdge
fn size(&self) -> usize
fn has_edge(&self, from: usize, to: usize) -> bool
fn add_vertex(&mut self)
fn add_edge(&mut self, from: usize, to: usize)
fn remove_edge(&mut self, from: usize, to: usize)
fn remove_edges_of_vertex(&mut self, vertex: usize)
fn remove_vertex(&mut self, vertex_index: usize)
fn vertices<'a>(&'a self) -> Box<dyn Iterator<Item = &'a VertexWithEdges> + 'a>
fn edges<'a>(&'a self) -> Box<dyn Iterator<Item = &'a UndirectedEdge> + 'a>
fn edges_of_vertex<'a>( &'a self, vertex: usize, ) -> Box<dyn Iterator<Item = &'a UndirectedEdge> + 'a>
fn neighbors_of_vertex(&self, vertex: usize) -> Vec<usize>
Source§impl GraphConstructor for SimpleGraph
impl GraphConstructor for SimpleGraph
Source§impl PartialEq for SimpleGraph
impl PartialEq for SimpleGraph
impl Eq for SimpleGraph
impl UndirectedGraph for SimpleGraph
Auto Trait Implementations§
impl Freeze for SimpleGraph
impl RefUnwindSafe for SimpleGraph
impl Send for SimpleGraph
impl Sync for SimpleGraph
impl Unpin for SimpleGraph
impl UnwindSafe for SimpleGraph
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.