Skip to main content

para_graph

Function para_graph 

Source
pub fn para_graph<Extra, V: GraphValue, R: Clone>(
    f: impl Fn(&GraphQuery<V>, &Pattern<V>, &[R]) -> R,
    view: &GraphView<Extra, V>,
) -> HashMap<V::Id, R>
where V::Id: Eq + Hash + Clone,
Expand description

Single-pass shape-aware structural fold over a GraphView.

Processes ALL elements (nodes, relationships, walks, annotations, other) in topo_shape_sort order so that each element receives already-computed results for its direct syntactic children (Pattern::elements).

The sub_results slice passed to f is best-effort: it contains one result per direct sub-element that has already been processed. For cycle-free graphs this is always complete. For cycle members within the GAnnotation or GOther buckets, other members of the cycle will be absent from sub_results. Handle sub_results = &[] as a valid, non-error input.

Returns a map from element identity to computed result.

Mirrors paraGraph in the Haskell reference implementation.