Skip to main content

pattern_match

Function pattern_match 

Source
pub fn pattern_match(
    graph: &MaterializedGraph,
    type_sequence: &[&str],
    max_results: usize,
) -> Vec<Vec<String>>
Expand description

Pattern match: find chains matching a sequence of node types connected by edges. E.g., ["source", "processor", "sink"] finds all matching chains. Returns list of chains, each chain being a list of node_ids. Find chains of nodes matching a type sequence (e.g., ["source", "processor", "sink"]).

Complexity: O(n * b^d) where n = nodes of first type, b = average branching, d = sequence length. Bounded by max_results to prevent runaway expansion on dense graphs. Cycle-safe: a node cannot appear twice in the same chain.