Diffo.Provider.Calculations.Traversal (Diffo v0.7.0)

Copy Markdown View Source

Runtime graph walk for a normalised via: hop list.

Threads a set of instance ids through each hop in order, following one edge per hop:

  • :forward — filter source_id in the current ids, collect target_ids.
  • :reverse — filter target_id in the current ids, collect source_ids.

over AssignmentRelationship (:assignment hops) or — for :relationship hops — both DefinedSimpleRelationship and the general Relationship (#222), since an edge is stored as one or the other and traversal is meaningful over either. A hop may fan out (reach many instances) or fan in (several intermediates reach the same instance); ids are de-duplicated between hops so a node reached by multiple paths is visited once.

Hops are the canonical form produced by Diffo.Provider.Extension.Traversal.normalize/2: {:forward | :reverse, :assignment | :relationship, selector}. Built so inherited_place / inherited_party can adopt the same grammar later.

Summary

Functions

Walks hops from start_id, returning the de-duplicated list of final instance ids.

Functions

walk(start_id, hops)

Walks hops from start_id, returning the de-duplicated list of final instance ids.

An empty hops list returns [start_id].