Struct graphific::BasicDirectedGraph[][src]

pub struct BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
{ /* fields omitted */ }

A basic implementation of a directed graph. It doesn't allow multiple edges but allow loops.

Implementations

impl<K, V> BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

pub fn new() -> Self[src]

Create a new directed graph. Complexity: O(1)

Trait Implementations

impl<K, V> Algorithms<K, V> for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

impl<K, V> AnyGraph<K, V> for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

fn vertices(&self) -> Vec<Vertex<K, V>>[src]

Get the vertices of the graph. Complexity: O(1*).

fn edges(&self) -> Vec<Edge<K>>[src]

Get the edges of the graph. Complexity: O(1*).

fn add_vertex(&self, vertex: Vertex<K, V>) -> Option<Self>[src]

Add a new vertex then return the graph. Complexity: O(1*).

fn remove_vertex(
    &self,
    vertex: &Vertex<K, V>
) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
[src]

Remove a vertex then return the new graph, the deleted vertex and its edges. Complexity: O(E).

fn remove_all_vertices(&self) -> Option<(Self, Vec<Vertex<K, V>>, Vec<Edge<K>>)>[src]

Remove all vertices then return the new graph, the deleted vertices and all the edges. Complexity: O(1*).

fn remove_vertex_where_key(
    &self,
    key: K
) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>
[src]

Remove a vertex by its key then return the new graph, the deleted vertex and its edges. Complexity: O(E).

fn add_edge(&self, edge: Edge<K>) -> Option<Self>[src]

Add a new edge then return the new graph. Complexity: O(1*).

fn add_edge_between_keys(&self, key_from: K, key_to: K) -> Option<Self>[src]

Add a new edge between 2 keys then return the new graph. Complexity: O(1*).

fn remove_edge(&self, edge: &Edge<K>) -> Option<(Self, Edge<K>)>[src]

Remove an existing edge then return the new graph and the deleted edge. Complexity: O(1*).

fn remove_edge_where_keys(
    &self,
    key_from: K,
    key_to: K
) -> Option<(Self, Edge<K>)>
[src]

Remove an existing edge by their keys, then return the new graph and the deleted edge. Complexity: O(1*).

fn remove_all_edges(&self) -> Option<(Self, Vec<Edge<K>>)>[src]

Remove all the edges then return the new graph and all the deleted edges. Complexity: O(1*).

fn remove_all_edges_where_vertex(
    &self,
    vertex: &Vertex<K, V>
) -> Option<(Self, Vec<Edge<K>>)>
[src]

Remove all existing edges from or to a given vertex, then return the new graph and the deleted edges. Complexity: O(E).

fn remove_all_edges_where_key(
    &self,
    key_from: K
) -> Option<(Self, Vec<Edge<K>>)>
[src]

Remove all existing edges from or to a given key, then return the new graph and the deleted edges. Complexity: O(E).

fn remove_all_edges_from_vertex(
    &self,
    vertex: &Vertex<K, V>
) -> Option<(Self, Vec<Edge<K>>)>
[src]

Remove all existing edges from a given vertex, then return the new graph and the deleted edges. Complexity: O(E).

fn remove_all_edges_from_key(&self, key_from: K) -> Option<(Self, Vec<Edge<K>>)>[src]

Remove all existing edges from a given key, then return the new graph and the deleted edges. Complexity: O(E).

impl<K: Clone, V: Clone> Clone for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

impl<K, V> Kinship<K, V> for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

fn successors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>[src]

Get the successors of each vertex. Complexity: O(V + E).

fn predecessors(&self) -> HashMap<Vertex<K, V>, Vec<Edge<K>>, RandomState>[src]

Get the predecessors of each vertex. Complexity: O(V + E).

impl<K: PartialEq, V: PartialEq> PartialEq<BasicDirectedGraph<K, V>> for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

impl<K, V> StructuralPartialEq for BasicDirectedGraph<K, V> where
    K: Key,
    V: Value
[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for BasicDirectedGraph<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<K, V> Send for BasicDirectedGraph<K, V> where
    K: Send,
    V: Send
[src]

impl<K, V> Sync for BasicDirectedGraph<K, V> where
    K: Sync,
    V: Sync
[src]

impl<K, V> Unpin for BasicDirectedGraph<K, V> where
    K: Unpin,
    V: Unpin
[src]

impl<K, V> UnwindSafe for BasicDirectedGraph<K, V> where
    K: UnwindSafe,
    V: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.