Skip to main content

conspire/math/graph/
mod.rs

1use crate::math::Set;
2
3/// A connected set of members or nodes.
4pub struct Graph {
5    adjacency: Set<Vec<Vec<usize>>>,
6}
7
8impl Graph {
9    pub fn adjacency(&self) -> &[Vec<usize>] {
10        self.adjacency.members()
11    }
12}
13
14impl From<Vec<Vec<usize>>> for Graph {
15    fn from(data: Vec<Vec<usize>>) -> Self {
16        let adjacency = data.into();
17        Self { adjacency }
18    }
19}