Skip to main content

DirectedGraph

Struct DirectedGraph 

Source
pub struct DirectedGraph<V, E>
where V: Send + Default + Clone + Sync + Debug, E: Send + Default + Clone + Sync + Debug,
{ /* 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>
where V: Send + Default + Clone + Sync + Debug + Clone, E: Send + Default + Clone + Sync + Debug + Clone,

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<V, E> Debug for DirectedGraph<V, E>
where V: Send + Default + Clone + Sync + Debug + Debug, E: Send + Default + Clone + Sync + Debug + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V, E> Default for DirectedGraph<V, E>
where V: Send + Default + Clone + Sync + Debug + Default, E: Send + Default + Clone + Sync + Debug + Default,

Source§

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>
where V: Send + Default + Clone + Sync + Debug, E: Send + Default + Clone + Sync + Debug,

Source§

fn contains_vertex(&self, vid: &i64) -> bool

True iff this vertex is in this graph

Source§

fn edges_iter(&self) -> impl Iterator<Item = (i64, i64)>

Iterator over all edges

Source§

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

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,

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,

Returns (from_vertex, b, E) where b is an out neighbour of from_vertex

Source§

fn remove_vertex(&mut self, vertex: &i64) -> Option<V>

Remove this vertex, returning the Any & all edges connected to this vertex are deleted.

Source§

fn new() -> Self

Source§

fn num_in_neighbours(&self, vertex: i64) -> Option<usize>

Source§

fn num_out_neighbours(&self, vertex: i64) -> Option<usize>

Source§

fn out_neighbours(&self, from_vertex: i64) -> impl Iterator<Item = i64>

Source§

fn out_neighbours_w_prop<'a>( &'a self, from_vertex: i64, ) -> impl Iterator<Item = (i64, &'a E)>
where E: 'a,

Source§

fn in_neighbours(&self, from_vertex: i64) -> impl Iterator<Item = i64>

Source§

fn num_vertexes(&self) -> usize

Source§

fn num_edges(&self) -> usize

Source§

fn edges_par_iter(&self) -> impl ParallelIterator<Item = (i64, i64)>

Source§

fn vertex_has_outgoing(&self, vid: &i64) -> bool

True iff this vertex has an outgoing edge
Source§

fn detailed_size(&self) -> String

Source§

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
Source§

fn is_empty(&self) -> bool

Source§

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

Vertex v exists, and has either in neighbours, xor out neighbours (but not both)
Source§

fn delete_edge(&mut self, vertex1: &i64, vertex2: &i64)

Source§

fn delete_vertex(&mut self, vertex: &i64)

Removes this vertex (& associated edges) from this graph
Source§

fn contract_vertex(&mut self, vertex: &i64, replacement: &i64)

Source§

fn vertexes_iter(&self) -> impl Iterator<Item = i64> + '_

Source§

fn vertexes_par_iter(&self) -> impl ParallelIterator<Item = i64>

Source§

fn into_disconnected_graphs( self, progress_bar: &ProgressBar, ) -> impl Iterator<Item = Self>

Source§

fn vertex_property(&self, vertex: &i64) -> Option<&V>

Source§

fn vertex_property_unchecked(&self, vertex: &i64) -> &V

Source§

fn set_vertex_property(&mut self, vertex: &i64, property: V)

Source§

fn vertex_property_mut(&mut self, vertex: &i64) -> &mut V

Source§

fn edge_property(&self, edge: (i64, i64)) -> Option<&E>

Source§

fn edge_property_unchecked(&self, edge: (i64, i64)) -> &E

Source§

fn set_edge_property(&mut self, edge: (i64, i64), property: E)

Source§

fn edge_property_mut(&mut self, edge: (i64, i64)) -> &mut E

Source§

fn add_edge_w_prop(&mut self, vertex1: i64, vertex2: i64, eprop: E)

Source§

fn add_vertex_w_prop(&mut self, vertex: i64, vprop: V)

Source§

fn in_edges_w_prop<'a>( &'a self, to_vertex: i64, ) -> impl Iterator<Item = (i64, i64, &'a E)>
where E: 'a,

Source§

fn edges_iter_w_prop<'a>(&'a self) -> impl Iterator<Item = (i64, i64, &'a E)>
where E: 'a,

Source§

fn edges_iter_w_prop_mut<'a>( &'a mut self, ) -> impl Iterator<Item = (i64, i64, &'a mut E)>
where E: 'a,

Source§

fn edges_par_iter_w_prop<'a>( &'a self, ) -> impl ParallelIterator<Item = (i64, i64, &'a E)>
where E: 'a,

Source§

fn edges_par_iter_w_prop_mut<'a>( &'a mut self, ) -> impl ParallelIterator<Item = (i64, i64, &'a mut E)>
where E: 'a,

Source§

fn assert_consistancy(&self)

Source§

fn remove_edge(&mut self, vertex1: &i64, vertex2: &i64) -> Option<E>

Source§

fn vertexes_w_prop<'a>(&'a self) -> impl Iterator<Item = (i64, &'a V)>
where V: 'a,

Source§

fn vertexes_w_prop_par_mut<'a>( &'a mut self, ) -> impl ParallelIterator<Item = (i64, &'a mut V)>
where V: 'a,

Source§

fn vertexes_w_prop_par<'a>( &'a self, ) -> impl ParallelIterator<Item = (i64, &'a V)>
where V: 'a,

Source§

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)>

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)>

Returns (from_vertex, b) where b is an out neighbour of from_vertex
Source§

fn edges(&self, vertex: i64) -> impl Iterator<Item = (i64, i64)>

All edges that go to/from this vertex. No guarantee of order.
Source§

fn all_connected_edges( &self, edge: &(i64, i64), ) -> impl Iterator<Item = (i64, i64)>

Source§

fn contains_edge( &self, from_vertex: impl Into<i64>, to_vertex: impl Into<i64>, ) -> bool

Source§

fn len(&self) -> (usize, usize)

Source§

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>

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,

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)>>

starting at point nid, follow all upstreams, in a DFS manner
Source§

fn expand_edge( &self, vertex1: i64, vertex2: i64, ) -> impl Iterator<Item = i64> + '_

Source§

fn vertexes(&self) -> impl Iterator<Item = i64> + '_

Iterator over all vertexes
Source§

fn add_edge_chain(&mut self, vertexes: &[i64]) -> bool

Add many vertexes & edges
Source§

fn into_vertexes_topologically_sorted( self, sorting_nodes_bar: &ProgressBar, ) -> Vec<i64>

Source§

fn strongly_connected_components( &self, calc_components_bar: &ProgressBar, ) -> Vec<Vec<[i64; 2]>>

Source§

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>

§

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>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool

Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.