pub struct Graph {
pub nodes: Vec<Node>,
pub edges: Vec<Edge>,
/* private fields */
}Expand description
The typed, bidirectional document multigraph.
Fields§
§nodes: Vec<Node>Nodes in input (document discovery) order.
edges: Vec<Edge>Edges in declaration order.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn build(docs: &[&StrayMarkDocument]) -> Graph
pub fn build(docs: &[&StrayMarkDocument]) -> Graph
Build the graph from parsed documents. Never drops a node or an edge:
orphan documents become isolated nodes; references to ids absent from
the corpus become resolved: false edges.
Sourcepub fn out_edges(&self, id: &str) -> impl Iterator<Item = &Edge>
pub fn out_edges(&self, id: &str) -> impl Iterator<Item = &Edge>
Outgoing edges of a node, in declaration order.
Sourcepub fn in_edges(&self, id: &str) -> impl Iterator<Item = &Edge>
pub fn in_edges(&self, id: &str) -> impl Iterator<Item = &Edge>
Incoming (resolved) edges of a node.
Sourcepub fn orphans(&self) -> impl Iterator<Item = &Node>
pub fn orphans(&self) -> impl Iterator<Item = &Node>
Documents with no links in either direction, in input order.
Sourcepub fn dangling_edges(&self) -> impl Iterator<Item = &Edge>
pub fn dangling_edges(&self) -> impl Iterator<Item = &Edge>
Edges whose target id is absent from the corpus, in declaration order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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