graph_algorithms

Trait GraphAlgorithm

Source
pub trait GraphAlgorithm {
    type Node;
    type Weight;

    // Required method
    fn run(&self, start: Self::Node) -> Result<Vec<Self::Weight>, GraphError>;
}
Expand description

A trait for graph search algorithms.

Required Associated Types§

Source

type Node

Type of node.

Source

type Weight

Type of weight.

Required Methods§

Source

fn run(&self, start: Self::Node) -> Result<Vec<Self::Weight>, GraphError>

Run the graph algorithm.

§Arguments
  • start: The starting node.
§Returns

Result containing a vector of shortest paths, or an error if applicable.

Implementors§