Struct DirectedGraph

Source
pub struct DirectedGraph<N = String, V = i64>
where N: Node, V: Weight,
{ /* private fields */ }

Implementations§

Source§

impl<N, V> DirectedGraph<N, V>
where N: Node, V: Weight,

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Trait Implementations§

Source§

impl<N, V> AsMut<AdjacencyTable<N, V>> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn as_mut(&mut self) -> &mut AdjacencyTable<N, V>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<N, V> AsRef<AdjacencyTable<N, V>> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn as_ref(&self) -> &AdjacencyTable<N, V>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<N, V> Clone for DirectedGraph<N, V>
where N: Node + Clone, V: Weight + Clone,

Source§

fn clone(&self) -> DirectedGraph<N, V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N, V> Contain<Edge<N, V>> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn contains(&self, elem: &Edge<N, V>) -> bool

Contain::contains returns true if the given element is in the Contain instance
Source§

fn contains_all(&self, iter: impl IntoIterator<Item = T>) -> bool

Contain::contains_all returns true if all elements in the given iterator are in the Contain instance
Source§

fn contains_some(&self, iter: impl IntoIterator<Item = T>) -> bool

Contain::contains_some returns true if any element in the given iterator is in the Contain instance
Source§

impl<N, V> Contain<N> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn contains(&self, elem: &N) -> bool

Contain::contains returns true if the given element is in the Contain instance
Source§

fn contains_all(&self, iter: impl IntoIterator<Item = T>) -> bool

Contain::contains_all returns true if all elements in the given iterator are in the Contain instance
Source§

fn contains_some(&self, iter: impl IntoIterator<Item = T>) -> bool

Contain::contains_some returns true if any element in the given iterator is in the Contain instance
Source§

impl<N, V> Debug for DirectedGraph<N, V>
where N: Node + Debug, V: Weight + Debug,

Source§

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

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

impl<N, V> Default for DirectedGraph<N, V>
where N: Node + Default, V: Weight + Default,

Source§

fn default() -> DirectedGraph<N, V>

Returns the “default value” for a type. Read more
Source§

impl<'de, N, V> Deserialize<'de> for DirectedGraph<N, V>
where N: Node + Deserialize<'de>, V: Weight + Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<N, V> From<AdjacencyTable<N, V>> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn from(store: AdjacencyTable<N, V>) -> Self

Converts to this type from the input type.
Source§

impl<N, V> Graph<N, V> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn store_mut(&mut self) -> &mut AdjacencyTable<N, V>

Graph::store_mut returns an owned, mutable instance of the AdjacencyTable
Source§

fn store(&self) -> &AdjacencyTable<N, V>

Graph::store returns an owned instance of the AdjacencyTable
Source§

fn add_edge(&mut self, edge: Edge<N, V>)

Graph::add_edge inserts a new Edge into the graph
Source§

fn add_edges(&mut self, iter: impl IntoIterator<Item = Edge<N, V>>)

Graph::add_edges insert several edges into the graph
Source§

fn add_node(&mut self, node: N) -> bool

Graph::add_node if the given Node is not already in the Graph, insert the Node and return true; else return false
Source§

fn add_nodes(&mut self, iter: impl IntoIterator<Item = N>)

Graph::add_nodes insert several nodes into the graph
Source§

fn contains_edge(&self, edge: &Edge<N, V>) -> bool

Graph::contains_edge returns true if the given Edge is in the graph
Source§

fn contains_node(&self, node: &N) -> bool

Graph::contains_node returns true if the given Node is in the graph
Source§

fn degree(&self, node: &N) -> Result<usize, GraphError>

Graph::degree returns the degree of the given Node
Source§

fn edges(&self) -> Vec<Edge<N, V>>

Graph::edges returns all of the edges persisting within the graph
Source§

fn edges_from(&self, node: &N) -> Result<Vec<Edge<N, V>>, GraphError>

Graph::edges_from returns all of the edges originating from the given Node
Source§

fn edges_to(&self, node: &N) -> Result<Vec<Edge<N, V>>, GraphError>

Graph::edges_to returns all of the edges terminating at the given Node
Source§

fn is_connected(&self) -> bool

Graph::is_connected returns true if the graph is connected
Source§

fn neighbors(&self, node: N) -> Result<&Vec<(N, V)>, GraphError>

Graph::neighbors attempts to return a Vec that contains all of the connected Node and their values
Source§

fn nodes(&self) -> HashSet<N>

Graph::nodes returns a cloned HashSet of the graph’s current Nodes
Source§

impl<N, V> Index<N> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

type Output = Vec<(N, V)>

The returned type after indexing.
Source§

fn index(&self, index: N) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<N, V> IndexMut<N> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn index_mut(&mut self, index: N) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<N, V> PartialEq for DirectedGraph<N, V>
where N: Node + PartialEq, V: Weight + PartialEq,

Source§

fn eq(&self, other: &DirectedGraph<N, V>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<N, V> Serialize for DirectedGraph<N, V>
where N: Node + Serialize, V: Weight + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<N, V> Subgraph<N, V> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

fn is_subgraph(&self, graph: impl Graph<N, V>) -> bool

Source§

impl<N, V> Eq for DirectedGraph<N, V>
where N: Node + Eq, V: Weight + Eq,

Source§

impl<N, V> GraphExt<N, V> for DirectedGraph<N, V>
where N: Node, V: Weight,

Source§

impl<N, V> StructuralPartialEq for DirectedGraph<N, V>
where N: Node, V: Weight,

Auto Trait Implementations§

§

impl<N, V> Freeze for DirectedGraph<N, V>

§

impl<N, V> RefUnwindSafe for DirectedGraph<N, V>

§

impl<N, V> Send for DirectedGraph<N, V>
where N: Send, V: Send,

§

impl<N, V> Sync for DirectedGraph<N, V>
where N: Sync, V: Sync,

§

impl<N, V> Unpin for DirectedGraph<N, V>
where N: Unpin, V: Unpin,

§

impl<N, V> UnwindSafe for DirectedGraph<N, V>
where N: UnwindSafe, V: UnwindSafe,

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> 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<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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Weight for T
where T: Clone + PartialEq,