Skip to main content

GraphAlgorithm

Trait GraphAlgorithm 

Source
pub trait GraphAlgorithm {
    type Node;
    type Weight;

    // Required method
    fn run(&self, start: Option<Self::Node>) -> Result<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: Option<Self::Node>) -> Result<Self::Weight, GraphError>

Run the graph algorithm.

§Arguments
  • start: Starting node, if applicable.
§Returns

Result containing the weight of the shortest path, or an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§