Skip to main content

graph_builder

Macro graph_builder 

Source
macro_rules! graph_builder {
    ($($source:expr => $target:expr),+ $(,)?) => { ... };
}
Expand description

Creates a graph builder from the given pairs.

This macro creates a Builder and adds nodes and edges based on the provided source-target pairs. It’s primarily intended for use in tests and examples to quickly set up graphs, and is not optimized for performance. Additionally, the node type must implement Copy.

§Examples

use zrx_graph::graph_builder;

// Create graph builder from pairs
let builder = graph_builder! {
    "a" => "b", "a" => "c",
    "b" => "c",
};