Struct cernan::matrix::Adjacency [−][src]
pub struct Adjacency<M: Clone> { /* fields omitted */ }
Adjacency matrix struct.
Methods
impl<M: Clone + Debug> Adjacency<M>
[src]
impl<M: Clone + Debug> Adjacency<M>
Poor man's adjacency matrix biased towards incident edge queries.
Edges are not symmetric. Two values are symmetrically adjacent when edges originate from each value to the other value.
pub fn new() -> Self
[src]
pub fn new() -> Self
Construct a new adjacency matrix.
pub fn add_asymmetric_edge(
&mut self,
from_str: &str,
to_str: &str,
metadata: Option<M>
)
[src]
pub fn add_asymmetric_edge(
&mut self,
from_str: &str,
to_str: &str,
metadata: Option<M>
)
Adds an outbound edge from a node to another.
pub fn add_edges(
&mut self,
from_str: &str,
to_strs: Vec<String>,
metadata: Option<M>
)
[src]
pub fn add_edges(
&mut self,
from_str: &str,
to_strs: Vec<String>,
metadata: Option<M>
)
Adds symmetric edges between the given node and a set of other nodes.
pub fn num_edges(&mut self, id: &str) -> usize
[src]
pub fn num_edges(&mut self, id: &str) -> usize
Returns the number of incident edges to the given node.
pub fn contains_node(&self, id: &str) -> bool
[src]
pub fn contains_node(&self, id: &str) -> bool
Returns true iff relations exist for the given node id.
pub fn filter_nodes<F>(&self, id: &str, f: F) -> Vec<String> where
F: FnMut(&'r (&String, &Option<M>)) -> bool,
[src]
pub fn filter_nodes<F>(&self, id: &str, f: F) -> Vec<String> where
F: FnMut(&'r (&String, &Option<M>)) -> bool,
Filters and returns edges satisfying the given constraint.
ⓘImportant traits for Iter<'a, K, V>pub fn iter(&self) -> Iter<String, HashMap<String, Option<M>>>
[src]
pub fn iter(&self) -> Iter<String, HashMap<String, Option<M>>>
Iterates over edge relations in the matrix.
pub fn pop(&mut self, id: &str) -> Option<HashMap<String, Option<M>>>
[src]
pub fn pop(&mut self, id: &str) -> Option<HashMap<String, Option<M>>>
Pops adjacency metadata for the given node.
pub fn pop_nodes(&mut self, id: &str) -> Vec<String>
[src]
pub fn pop_nodes(&mut self, id: &str) -> Vec<String>
As pop, but returns a vec of node identifiers connected to the given node.
pub fn pop_metadata(&mut self, id: &str) -> Vec<M>
[src]
pub fn pop_metadata(&mut self, id: &str) -> Vec<M>
As pop, but returns a vec of edge metadata. Option values will be unwrapped and None values filtered.