Trait graph::DirectedGraph[][src]

pub trait DirectedGraph<Node: Idx>: Graph<Node> {
    fn out_degree(&self, node: Node) -> Node;
fn out_neighbors(&self, node: Node) -> &[Node];
fn in_degree(&self, node: Node) -> Node;
fn in_neighbors(&self, node: Node) -> &[Node]; }
Expand description

A graph where the order within an edge tuple is important.

An edge tuple e = (u, v) has a source node u and a target node v. From the perspective of u, the edge e is an outgoing edge. From the perspective of node v, the edge e is an incoming edge. The edges (u, v) and (v, u) are not considered equivalent.

Required methods

Returns the number of edges where the given node is a source node.

Returns a slice of all nodes which are connected in outgoing direction to the given node, i.e., the given node is the source node of the connecting edge.

Returns the number of edges where the given node is a target node.

Returns a slice of all nodes which are connected in incoming direction to the given node, i.e., the given node is the target node of the connecting edge.

Implementors