Trait graphific::AnyGraph[][src]

pub trait AnyGraph<K, V>: Sized + Clone + PartialEq where
    K: Key,
    V: Value
{ fn vertices(&self) -> Vec<Vertex<K, V>>;
fn edges(&self) -> Vec<Edge<K>>;
fn add_vertex(&self, vertex: Vertex<K, V>) -> Option<Self>;
fn remove_vertex(
        &self,
        vertex: &Vertex<K, V>
    ) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>;
fn remove_all_vertices(
        &self
    ) -> Option<(Self, Vec<Vertex<K, V>>, Vec<Edge<K>>)>;
fn remove_vertex_where_key(
        &self,
        key: K
    ) -> Option<(Self, Vertex<K, V>, Vec<Edge<K>>)>;
fn add_edge(&self, edge: Edge<K>) -> Option<Self>;
fn add_edge_between_keys(&self, key_from: K, key_to: K) -> Option<Self>;
fn remove_edge(&self, edge: &Edge<K>) -> Option<(Self, Edge<K>)>;
fn remove_edge_where_keys(
        &self,
        key_from: K,
        key_to: K
    ) -> Option<(Self, Edge<K>)>;
fn remove_all_edges(&self) -> Option<(Self, Vec<Edge<K>>)>;
fn remove_all_edges_where_vertex(
        &self,
        vertex: &Vertex<K, V>
    ) -> Option<(Self, Vec<Edge<K>>)>;
fn remove_all_edges_where_key(
        &self,
        key_from: K
    ) -> Option<(Self, Vec<Edge<K>>)>;
fn remove_all_edges_from_vertex(
        &self,
        vertex: &Vertex<K, V>
    ) -> Option<(Self, Vec<Edge<K>>)>;
fn remove_all_edges_from_key(
        &self,
        key_from: K
    ) -> Option<(Self, Vec<Edge<K>>)>; }

An interface used to describe any kind of graph.

Generic implementations

K describe a type of Key to use. V describe a type of Value to store.

Required methods

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

Get the vertices of the graph.

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

Get the edges of the graph.

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

Add a new vertex then return the graph.

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.

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.

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.

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

Add a new edge then return the new graph.

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.

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.

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.

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.

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.

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.

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.

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.

Loading content...

Implementors

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, V> AnyGraph<K, V> for BasicUndirectedGraph<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).

Loading content...