GraphCast

Trait GraphCast 

Source
pub trait GraphCast<Target: Graph>: Graph {
    // Required method
    fn cast_graph(&self) -> Target;
}
Expand description

Trait for casting a graph to a supertype in the graph hierarchy.

When A: GraphCast<B>, graph A can be losslessly converted to graph B by extracting the adjacency structure. This enables natural-edge reductions where a problem on a specific graph type is solved by treating it as a more general graph.

Required Methods§

Source

fn cast_graph(&self) -> Target

Convert this graph to the target graph type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<G: Graph> GraphCast<SimpleGraph> for G

Any graph can be cast to a SimpleGraph by extracting vertices and edges.