Struct cernan::matrix::Adjacency
[−]
[src]
pub struct Adjacency<M: Clone> { /* fields omitted */ }
Adjacency matrix struct.
Methods
impl<M: Clone + Debug> Adjacency<M>
[src]
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]
Construct a new adjacency matrix.
pub fn add_asymmetric_edge(
&mut self,
from_str: &str,
to_str: &str,
metadata: Option<M>
)
[src]
&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]
&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]
Returns the number of incident edges to the given node.
pub fn contains_node(&self, id: &str) -> bool
[src]
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]
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]
Iterates over edge relations in the matrix.
pub fn pop(&mut self, id: &str) -> Option<HashMap<String, Option<M>>>
[src]
Pops adjacency metadata for the given node.
pub fn pop_nodes(&mut self, id: &str) -> Vec<String>
[src]
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]
As pop, but returns a vec of edge metadata. Option values will be unwrapped and None values filtered.