pub struct DirectedGraph<V, E>{ /* private fields */ }Expand description
A graph which stores a list of all incoming and outgoing edges
Trait Implementations§
Source§impl<V, E> Clone for DirectedGraph<V, E>
impl<V, E> Clone for DirectedGraph<V, E>
Source§fn clone(&self) -> DirectedGraph<V, E>
fn clone(&self) -> DirectedGraph<V, E>
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<V, E> Debug for DirectedGraph<V, E>
impl<V, E> Debug for DirectedGraph<V, E>
Source§impl<V, E> Default for DirectedGraph<V, E>
impl<V, E> Default for DirectedGraph<V, E>
Source§fn default() -> DirectedGraph<V, E>
fn default() -> DirectedGraph<V, E>
Returns the “default value” for a type. Read more
Source§impl<V, E> DirectedGraphTrait<V, E> for DirectedGraph<V, E>
impl<V, E> DirectedGraphTrait<V, E> for DirectedGraph<V, E>
Source§fn contains_vertex(&self, vid: &i64) -> bool
fn contains_vertex(&self, vid: &i64) -> bool
True iff this vertex is in this graph
Source§fn vertexes_and_num_outs(&self) -> impl Iterator<Item = (i64, usize)>
fn vertexes_and_num_outs(&self) -> impl Iterator<Item = (i64, usize)>
returns each vertex and the number of out edges
Source§fn add_edge(&mut self, vertex1: i64, vertex2: i64) -> bool
fn add_edge(&mut self, vertex1: i64, vertex2: i64) -> bool
Adds an edge between these 2, returning true iff the edge already existed
Source§fn out_edges_w_prop<'a>(
&'a self,
from_vertex: i64,
) -> impl Iterator<Item = (i64, i64, &'a E)>where
E: 'a,
fn out_edges_w_prop<'a>(
&'a self,
from_vertex: i64,
) -> impl Iterator<Item = (i64, i64, &'a E)>where
E: 'a,
Returns (from_vertex, b, E) where b is an out neighbour of from_vertex
Source§fn out_edges_w_prop_mut<'a>(
&'a mut self,
from_vertex: i64,
) -> impl Iterator<Item = (i64, i64, &'a mut E)>where
E: 'a,
fn out_edges_w_prop_mut<'a>(
&'a mut self,
from_vertex: i64,
) -> impl Iterator<Item = (i64, i64, &'a mut E)>where
E: 'a,
Returns (from_vertex, b, E) where b is an out neighbour of from_vertex
Source§fn remove_vertex(&mut self, vertex: &i64) -> Option<V>
fn remove_vertex(&mut self, vertex: &i64) -> Option<V>
Remove this vertex, returning the Any & all edges connected to this vertex are deleted.
fn new() -> Self
fn num_in_neighbours(&self, vertex: i64) -> Option<usize>
fn num_out_neighbours(&self, vertex: i64) -> Option<usize>
fn out_neighbours(&self, from_vertex: i64) -> impl Iterator<Item = i64>
fn out_neighbours_w_prop<'a>(
&'a self,
from_vertex: i64,
) -> impl Iterator<Item = (i64, &'a E)>where
E: 'a,
fn in_neighbours(&self, from_vertex: i64) -> impl Iterator<Item = i64>
fn num_vertexes(&self) -> usize
fn num_edges(&self) -> usize
fn edges_par_iter(&self) -> impl ParallelIterator<Item = (i64, i64)>
Source§fn vertex_has_outgoing(&self, vid: &i64) -> bool
fn vertex_has_outgoing(&self, vid: &i64) -> bool
True iff this vertex has an outgoing edge
fn detailed_size(&self) -> String
Source§fn num_ins_zero(&self, vid: &i64) -> bool
fn num_ins_zero(&self, vid: &i64) -> bool
True iff this vertex does not have ≥1 edges. this happens with zero in edges, or if the
edge doesn’t exist
when doing topological sorting, we remove edges, which can remove the vertex when there are
no more incoming
fn is_empty(&self) -> bool
Source§fn vertexes_and_num_ins_outs(
&self,
) -> impl Iterator<Item = (i64, usize, usize)> + '_
fn vertexes_and_num_ins_outs( &self, ) -> impl Iterator<Item = (i64, usize, usize)> + '_
returns each vertex and the number of in & out edges
Source§fn neighbors_in_xor_out(&mut self, v: &i64) -> bool
fn neighbors_in_xor_out(&mut self, v: &i64) -> bool
Vertex v exists, and has either in neighbours, xor out neighbours (but not both)
fn delete_edge(&mut self, vertex1: &i64, vertex2: &i64)
Source§fn delete_vertex(&mut self, vertex: &i64)
fn delete_vertex(&mut self, vertex: &i64)
Removes this vertex (& associated edges) from this graph
fn contract_vertex(&mut self, vertex: &i64, replacement: &i64)
fn vertexes_iter(&self) -> impl Iterator<Item = i64> + '_
fn vertexes_par_iter(&self) -> impl ParallelIterator<Item = i64>
fn into_disconnected_graphs( self, progress_bar: &ProgressBar, ) -> impl Iterator<Item = Self>
fn vertex_property(&self, vertex: &i64) -> Option<&V>
fn vertex_property_unchecked(&self, vertex: &i64) -> &V
fn set_vertex_property(&mut self, vertex: &i64, property: V)
fn vertex_property_mut(&mut self, vertex: &i64) -> &mut V
fn edge_property(&self, edge: (i64, i64)) -> Option<&E>
fn edge_property_unchecked(&self, edge: (i64, i64)) -> &E
fn set_edge_property(&mut self, edge: (i64, i64), property: E)
fn edge_property_mut(&mut self, edge: (i64, i64)) -> &mut E
fn add_edge_w_prop(&mut self, vertex1: i64, vertex2: i64, eprop: E)
fn add_vertex_w_prop(&mut self, vertex: i64, vprop: V)
fn in_edges_w_prop<'a>(
&'a self,
to_vertex: i64,
) -> impl Iterator<Item = (i64, i64, &'a E)>where
E: 'a,
fn edges_iter_w_prop<'a>(&'a self) -> impl Iterator<Item = (i64, i64, &'a E)>where
E: 'a,
fn edges_iter_w_prop_mut<'a>(
&'a mut self,
) -> impl Iterator<Item = (i64, i64, &'a mut E)>where
E: 'a,
fn edges_par_iter_w_prop<'a>(
&'a self,
) -> impl ParallelIterator<Item = (i64, i64, &'a E)>where
E: 'a,
fn edges_par_iter_w_prop_mut<'a>(
&'a mut self,
) -> impl ParallelIterator<Item = (i64, i64, &'a mut E)>where
E: 'a,
fn assert_consistancy(&self)
fn remove_edge(&mut self, vertex1: &i64, vertex2: &i64) -> Option<E>
fn vertexes_w_prop<'a>(&'a self) -> impl Iterator<Item = (i64, &'a V)>where
V: 'a,
fn vertexes_w_prop_par_mut<'a>(
&'a mut self,
) -> impl ParallelIterator<Item = (i64, &'a mut V)>where
V: 'a,
fn vertexes_w_prop_par<'a>(
&'a self,
) -> impl ParallelIterator<Item = (i64, &'a V)>where
V: 'a,
fn edges_w_prop_par_mut<'a>(
&'a mut self,
) -> impl ParallelIterator<Item = ((i64, i64), &'a mut E)>where
E: 'a,
Source§fn in_edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
fn in_edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
Returns (a, to_vertex) where a is an in neighbour of to_vertex
Source§fn out_edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
fn out_edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
Returns (from_vertex, b) where b is an out neighbour of from_vertex
Source§fn edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
fn edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>
All edges that go to/from this vertex. No guarantee of order.
fn all_connected_edges( &self, edge: &(i64, i64), ) -> impl Iterator<Item = (i64, i64)>
fn contains_edge( &self, from_vertex: impl Into<i64>, to_vertex: impl Into<i64>, ) -> bool
fn len(&self) -> (usize, usize)
Source§fn dest_vertexes_jumbled(&self) -> impl ParallelIterator<Item = i64>
fn dest_vertexes_jumbled(&self) -> impl ParallelIterator<Item = i64>
Iterator (in any order) of vertexes which are the destination of an edge
Source§fn src_vertexes_jumbled(&self) -> impl Iterator<Item = i64>
fn src_vertexes_jumbled(&self) -> impl Iterator<Item = i64>
Iterator (in any order) of vertexes which are the src of an edge
Source§fn vertexes_wo_outgoing_jumbled(&self) -> impl ParallelIterator<Item = i64>where
Self: Sync,
fn vertexes_wo_outgoing_jumbled(&self) -> impl ParallelIterator<Item = i64>where
Self: Sync,
Iterator (in any order, possibly with dupes) of vertexes which do not have outgoing edges
Source§fn all_in_edges_recursive(
&self,
nid: i64,
incl_nid: impl Fn(&i64) -> bool,
nodeid_pos: &impl NodeIdPosition,
) -> impl Iterator<Item = Vec<(f64, f64)>>
fn all_in_edges_recursive( &self, nid: i64, incl_nid: impl Fn(&i64) -> bool, nodeid_pos: &impl NodeIdPosition, ) -> impl Iterator<Item = Vec<(f64, f64)>>
starting at point
nid, follow all upstreams, in a DFS mannerfn expand_edge( &self, vertex1: i64, vertex2: i64, ) -> impl Iterator<Item = i64> + '_
Source§fn add_edge_chain(&mut self, vertexes: &[i64]) -> bool
fn add_edge_chain(&mut self, vertexes: &[i64]) -> bool
Add many vertexes & edges
fn into_vertexes_topologically_sorted( self, sorting_nodes_bar: &ProgressBar, ) -> Vec<i64>
fn strongly_connected_components( &self, calc_components_bar: &ProgressBar, ) -> Vec<Vec<[i64; 2]>>
fn delete_vertex_if_unconnected(&mut self, vertex: &i64)
Auto Trait Implementations§
impl<V, E> Freeze for DirectedGraph<V, E>
impl<V, E> RefUnwindSafe for DirectedGraph<V, E>where
V: RefUnwindSafe,
E: RefUnwindSafe,
impl<V, E> Send for DirectedGraph<V, E>
impl<V, E> Sync for DirectedGraph<V, E>
impl<V, E> Unpin for DirectedGraph<V, E>
impl<V, E> UnsafeUnpin for DirectedGraph<V, E>
impl<V, E> UnwindSafe for DirectedGraph<V, E>where
V: RefUnwindSafe,
E: RefUnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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 moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.