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 for ReifiedGraph<T>where
T: Clone,
impl<T> Clone for ReifiedGraph<T>where
T: Clone,
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 moreSource§impl<T> Debug for ReifiedGraph<T>where
T: Debug,
impl<T> Debug for ReifiedGraph<T>where
T: Debug,
Source§impl<'de, T> Deserialize<'de> for ReifiedGraph<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ReifiedGraph<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReifiedGraph<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReifiedGraph<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Serialize for ReifiedGraph<T>where
T: Serialize,
impl<T> Serialize for ReifiedGraph<T>where
T: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto 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