pub struct BasicDirectedGraph<K, V>{ /* private fields */ }
Expand description
A basic implementation of a directed graph. It doesn’t allow multiple edges but allow loops.
Implementations§
Trait Implementations§
Source§impl<K, V> Algorithms<K, V> for BasicDirectedGraph<K, V>
impl<K, V> Algorithms<K, V> for BasicDirectedGraph<K, V>
Source§fn bfs(&self) -> Option<Self>
fn bfs(&self) -> Option<Self>
Source§fn bfs_with_starting_vertex(
&self,
starting_vertex: &Vertex<K, V>,
) -> Option<Self>
fn bfs_with_starting_vertex( &self, starting_vertex: &Vertex<K, V>, ) -> Option<Self>
Source§fn dfs(&self) -> Option<Self>
fn dfs(&self) -> Option<Self>
Source§fn dfs_with_starting_vertex(
&self,
starting_vertex: &Vertex<K, V>,
) -> Option<Self>
fn dfs_with_starting_vertex( &self, starting_vertex: &Vertex<K, V>, ) -> Option<Self>
Source§impl<K, V> AnyGraph<K, V> for BasicDirectedGraph<K, V>
impl<K, V> AnyGraph<K, V> for BasicDirectedGraph<K, V>
Source§fn add_vertex(&self, vertex: Vertex<K, V>) -> Option<Self>
fn add_vertex(&self, vertex: Vertex<K, V>) -> Option<Self>
Add a new vertex then return the graph. Complexity: O(1*).
Source§fn remove_vertex(
&self,
vertex: &Vertex<K, V>,
) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
fn remove_vertex( &self, vertex: &Vertex<K, V>, ) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
Remove a vertex then return the new graph, the deleted vertex and its edges. Complexity: O(E).
Source§fn remove_all_vertices(&self) -> Option<(Self, Vec<Vertex<K, V>>, Vec<Edge<K>>)>
fn remove_all_vertices(&self) -> Option<(Self, Vec<Vertex<K, V>>, Vec<Edge<K>>)>
Remove all vertices then return the new graph, the deleted vertices and all the edges. Complexity: O(1*).
Source§fn remove_vertex_where_key(
&self,
key: K,
) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
fn remove_vertex_where_key( &self, key: K, ) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
Remove a vertex by its key then return the new graph, the deleted vertex and its edges. Complexity: O(E).
Source§fn add_edge(&self, edge: Edge<K>) -> Option<Self>
fn add_edge(&self, edge: Edge<K>) -> Option<Self>
Add a new edge then return the new graph. Complexity: O(1*).
Source§fn add_edge_between_keys(&self, key_from: K, key_to: K) -> Option<Self>
fn add_edge_between_keys(&self, key_from: K, key_to: K) -> Option<Self>
Add a new edge between 2 keys then return the new graph. Complexity: O(1*).
Source§fn remove_edge(&self, edge: &Edge<K>) -> Option<(Self, Edge<K>)>
fn remove_edge(&self, edge: &Edge<K>) -> Option<(Self, Edge<K>)>
Remove an existing edge then return the new graph and the deleted edge. Complexity: O(1*).
Source§fn remove_edge_where_keys(
&self,
key_from: K,
key_to: K,
) -> Option<(Self, Edge<K>)>
fn remove_edge_where_keys( &self, key_from: K, key_to: K, ) -> Option<(Self, Edge<K>)>
Remove an existing edge by their keys, then return the new graph and the deleted edge. Complexity: O(1*).
Source§fn remove_all_edges(&self) -> Option<(Self, Vec<Edge<K>>)>
fn remove_all_edges(&self) -> Option<(Self, Vec<Edge<K>>)>
Remove all the edges then return the new graph and all the deleted edges. Complexity: O(1*).
Source§fn remove_all_edges_where_vertex(
&self,
vertex: &Vertex<K, V>,
) -> Option<(Self, Vec<Edge<K>>)>
fn remove_all_edges_where_vertex( &self, vertex: &Vertex<K, V>, ) -> Option<(Self, Vec<Edge<K>>)>
Remove all existing edges from or to a given vertex, then return the new graph and the deleted edges. Complexity: O(E).
Source§fn remove_all_edges_where_key(
&self,
key_from: K,
) -> Option<(Self, Vec<Edge<K>>)>
fn remove_all_edges_where_key( &self, key_from: K, ) -> Option<(Self, Vec<Edge<K>>)>
Remove all existing edges from or to a given key, then return the new graph and the deleted edges. Complexity: O(E).
Source§impl<K, V> Clone for BasicDirectedGraph<K, V>
impl<K, V> Clone for BasicDirectedGraph<K, V>
Source§fn clone(&self) -> BasicDirectedGraph<K, V>
fn clone(&self) -> BasicDirectedGraph<K, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<K, V> Kinship<K, V> for BasicDirectedGraph<K, V>
impl<K, V> Kinship<K, V> for BasicDirectedGraph<K, V>
Source§fn successors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>
fn successors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>
Get the successors of each vertex. Complexity: O(V + E).
Source§fn predecessors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>
fn predecessors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>
Get the predecessors of each vertex. Complexity: O(V + E).
Source§fn successors_as_key_and_edges(&self) -> HashMap<K, Vec<Edge<K>>>
fn successors_as_key_and_edges(&self) -> HashMap<K, Vec<Edge<K>>>
Key
.Source§fn predecessors_as_key_and_edges(&self) -> HashMap<K, Vec<Edge<K>>>
fn predecessors_as_key_and_edges(&self) -> HashMap<K, Vec<Edge<K>>>
Key
.