Skip to main content

from_pattern_graph

Function from_pattern_graph 

Source
pub fn from_pattern_graph<Extra, V>(
    graph: Rc<PatternGraph<Extra, V>>,
) -> GraphQuery<V>
where Extra: 'static, V: GraphValue + Clone + 'static, V::Id: Clone + Eq + Hash + 'static,
Expand description

Wraps a PatternGraph in a GraphQuery<V>.

All nine GraphQuery fields are implemented against the PatternGraph maps.

§Complexity

  • query_nodes / query_relationships: O(n) / O(r) to collect values
  • query_incident_rels: O(r) scan of all relationships
  • query_source / query_target: O(1) element access
  • query_degree: O(r) scan
  • query_node_by_id / query_relationship_by_id: O(1) average HashMap lookup
  • query_containers: O(r + w + a) scan of relationships, walks, annotations

§Deferred

TODO: from_graph_lens — deferred until GraphLens type is available in pattern-rs.

Rc and Arc variants are intentionally separate (no macro): only one is compiled per build, trait bounds stay clear, and we avoid fragile abstraction over pointer types.