pub struct GraphQuery<V: GraphValue> {
pub query_nodes: Rc<dyn Fn() -> Vec<Pattern<V>>>,
pub query_relationships: Rc<dyn Fn() -> Vec<Pattern<V>>>,
pub query_incident_rels: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>,
pub query_source: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>,
pub query_target: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>,
pub query_degree: Rc<dyn Fn(&Pattern<V>) -> usize>,
pub query_node_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>,
pub query_relationship_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>,
pub query_containers: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>,
}Expand description
Portable graph query interface: a struct of nine closures.
All graph algorithms operate against GraphQuery<V>, not against any specific
backing representation. Cloning is cheap — it increments reference counts only.
§Construction
Use crate::from_pattern_graph to wrap a crate::PatternGraph, or build
manually by providing all nine closure fields.
§Thread Safety
By default uses Rc (single-threaded). Enable the thread-safe Cargo feature
to use Arc with Send + Sync bounds throughout.
Fields§
§query_nodes: Rc<dyn Fn() -> Vec<Pattern<V>>>Returns all node patterns in the graph.
query_relationships: Rc<dyn Fn() -> Vec<Pattern<V>>>Returns all relationship patterns in the graph.
query_incident_rels: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>Returns all relationships incident to the given node (as source or target).
query_source: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>Returns the source node of a relationship, or None if not available.
query_target: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>Returns the target node of a relationship, or None if not available.
query_degree: Rc<dyn Fn(&Pattern<V>) -> usize>Returns the count of incident relationships for a node.
query_node_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>Returns the node with the given identity, or None.
query_relationship_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>Returns the relationship with the given identity, or None.
query_containers: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>Returns all direct containers of the given element (relationships, walks, annotations).
Trait Implementations§
Source§impl<V: GraphValue> Clone for GraphQuery<V>
Available on non-crate feature thread-safe only.
impl<V: GraphValue> Clone for GraphQuery<V>
thread-safe only.