pub struct ReifiedGraph<T> {
pub nodes: Vec<(NodeId, T)>,
pub edges: Vec<(NodeId, NodeId)>,
pub root: NodeId,
}Expand description
An adjacency-list representation of a pointer graph.
Contains all nodes with their data, directed edges between nodes, and the identifier of the root node.
§Examples
use reify_graph::{ReifiedGraph, NodeId};
let graph = ReifiedGraph {
nodes: vec![(NodeId(0), "root"), (NodeId(1), "child")],
edges: vec![(NodeId(0), NodeId(1))],
root: NodeId(0),
};
assert_eq!(graph.nodes.len(), 2);Fields§
§nodes: Vec<(NodeId, T)>The nodes in the graph, each paired with its stable identifier.
edges: Vec<(NodeId, NodeId)>Directed edges from parent to child.
root: NodeIdThe root node’s identifier.
Trait Implementations§
Source§impl<T: Clone> Clone for ReifiedGraph<T>
impl<T: Clone> Clone for ReifiedGraph<T>
Source§fn clone(&self) -> ReifiedGraph<T>
fn clone(&self) -> ReifiedGraph<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for ReifiedGraph<T>
impl<T> RefUnwindSafe for ReifiedGraph<T>where
T: RefUnwindSafe,
impl<T> Send for ReifiedGraph<T>where
T: Send,
impl<T> Sync for ReifiedGraph<T>where
T: Sync,
impl<T> Unpin for ReifiedGraph<T>where
T: Unpin,
impl<T> UnsafeUnpin for ReifiedGraph<T>
impl<T> UnwindSafe for ReifiedGraph<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more