Skip to main content

Node

Trait Node 

Source
pub trait Node<'graph> {
    type Graph: Graph;

    // Required methods
    fn new(
        id: <Self::Graph as Graph>::NodeId,
        graph: &'graph Self::Graph,
    ) -> Self;
    fn id(&self) -> <Self::Graph as Graph>::NodeId;
    fn graph(&self) -> &'graph Self::Graph;
    fn edge_ids(
        &self,
    ) -> &'graph HashSet<<Self::Graph as Graph>::EdgeId, <Self::Graph as Graph>::Hasher>;
    fn edge_count(&self) -> usize;

    // Provided methods
    fn is_leaf(&self) -> bool { ... }
    fn edges(&self) -> Iter<'graph, EdgeMode, Self::Graph>  { ... }
    fn children(&self) -> Iter<'graph, ChildMode, Self::Graph>  { ... }
    fn parents(&self) -> Iter<'graph, ParentMode, Self::Graph>  { ... }
}

Required Associated Types§

Required Methods§

Source

fn new(id: <Self::Graph as Graph>::NodeId, graph: &'graph Self::Graph) -> Self

Source

fn id(&self) -> <Self::Graph as Graph>::NodeId

Returns this node identifier.

Source

fn graph(&self) -> &'graph Self::Graph

Returns the backing graph reference for this node.

Source

fn edge_ids( &self, ) -> &'graph HashSet<<Self::Graph as Graph>::EdgeId, <Self::Graph as Graph>::Hasher>

Retrieve the ids of all edges incident to this node.

Source

fn edge_count(&self) -> usize

Returns the number of incident edges for this node.

Provided Methods§

Source

fn is_leaf(&self) -> bool

Returns true if this node has no connected edges.

Source

fn edges(&self) -> Iter<'graph, EdgeMode, Self::Graph>

Iterates over all incident edges.

Source

fn children(&self) -> Iter<'graph, ChildMode, Self::Graph>

Iterates over child relationships for outgoing edges.

Source

fn parents(&self) -> Iter<'graph, ParentMode, Self::Graph>

Iterates over parent relationships for incoming edges.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'graph, NodeId: Identifier, EdgeId: Identifier, NodeData, EdgeData> Node<'graph> for NodeRef<'graph, NodeId, EdgeId, NodeData, EdgeData>

Source§

type Graph = OwningGraph<NodeId, EdgeId, NodeData, EdgeData>