[][src]Struct gchemol_graph::NxGraph

pub struct NxGraph<N, E> where
    N: Default,
    E: Default
{ /* fields omitted */ }

networkx-like API wrapper around petgraph

Methods

impl<N, E> NxGraph<N, E> where
    N: Default,
    E: Default
[src]

pub fn new() -> Self[src]

impl<N, E> NxGraph<N, E> where
    N: Default,
    E: Default
[src]

pub fn neighbors(
    &self,
    current: NodeIndex
) -> impl Iterator<Item = NodeIndex> + '_
[src]

Return neighboring nodes of current node.

pub fn has_node(&self, n: NodeIndex) -> bool[src]

Returns true if the graph contains the node n.

Parameters

n : node

pub fn has_edge(&self, u: NodeIndex, v: NodeIndex) -> bool[src]

Returns true if the edge (u, v) is in the graph.

pub fn number_of_nodes(&self) -> usize[src]

Returns the number of nodes in the graph.

pub fn number_of_edges(&self) -> usize[src]

Returns the number of edges in the graph.

impl<N, E> NxGraph<N, E> where
    N: Default,
    E: Default
[src]

pub fn add_node(&mut self, data: N) -> NodeIndex[src]

Add a node with associated data into graph.

pub fn add_edge(&mut self, u: NodeIndex, v: NodeIndex, data: E)[src]

Add an edge with data between u and v.

pub fn remove_edge(&mut self, node1: NodeIndex, node2: NodeIndex) -> Option<E>[src]

Remove an edge between node1 and node2. Return None if trying to remove a non-existent edge.

pub fn remove_node(&mut self, n: NodeIndex) -> Option<N>[src]

Removes the node n and all adjacent edges. Return None if trying to remove a non-existent node.

pub fn clear(&mut self)[src]

Remove all nodes and edges

impl<N, E> NxGraph<N, E> where
    N: Default,
    E: Default
[src]

Important traits for Nodes<'a, N, E>
pub fn nodes(&self) -> Nodes<N, E>[src]

A Node view of the Graph.

Important traits for Edges<'a, N, E>
pub fn edges(&self) -> Edges<N, E>[src]

An Edge view of the Graph.

Trait Implementations

impl<N: Clone, E: Clone> Clone for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

impl<N: Debug, E: Debug> Debug for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

impl<N: Default, E: Default> Default for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

impl<'de, N, E> Deserialize<'de> for NxGraph<N, E> where
    N: Default,
    E: Default,
    N: Deserialize<'de>,
    E: Deserialize<'de>, 
[src]

impl<N, E> Index<(NodeIndex<u32>, NodeIndex<u32>)> for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

type Output = E

The returned type after indexing.

impl<N, E> Index<NodeIndex<u32>> for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

type Output = N

The returned type after indexing.

impl<N, E> IndexMut<(NodeIndex<u32>, NodeIndex<u32>)> for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

impl<N, E> IndexMut<NodeIndex<u32>> for NxGraph<N, E> where
    N: Default,
    E: Default
[src]

impl<N, E> Serialize for NxGraph<N, E> where
    N: Default,
    E: Default,
    N: Serialize,
    E: Serialize
[src]

Auto Trait Implementations

impl<N, E> RefUnwindSafe for NxGraph<N, E> where
    E: RefUnwindSafe,
    N: RefUnwindSafe

impl<N, E> Send for NxGraph<N, E> where
    E: Send,
    N: Send

impl<N, E> Sync for NxGraph<N, E> where
    E: Sync,
    N: Sync

impl<N, E> Unpin for NxGraph<N, E> where
    E: Unpin,
    N: Unpin

impl<N, E> UnwindSafe for NxGraph<N, E> where
    E: UnwindSafe,
    N: UnwindSafe

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