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., ["signal", "rule", "plan", "action"] finds all MAPE-K loops. Returns list of chains, each chain being a list of node_ids. Find chains of nodes matching a type sequence (e.g., ["signal", "rule", "plan"]).

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.