Skip to main content

GraphStorage

Trait GraphStorage 

Source
pub trait GraphStorage {
Show 57 methods // Required methods fn contains_node(&self, id: NodeId) -> bool; fn node(&self, id: NodeId) -> Option<NodeRecord>; fn all_node_ids(&self) -> Vec<NodeId> ; fn node_ids_by_label(&self, label: &str) -> Vec<NodeId> ; fn contains_relationship(&self, id: RelationshipId) -> bool; fn relationship(&self, id: RelationshipId) -> Option<RelationshipRecord>; fn all_rel_ids(&self) -> Vec<RelationshipId> ; fn rel_ids_by_type(&self, rel_type: &str) -> Vec<RelationshipId> ; fn relationship_endpoints( &self, id: RelationshipId, ) -> Option<(NodeId, NodeId)>; fn expand_ids( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipId, NodeId)>; fn all_labels(&self) -> Vec<String>; fn all_relationship_types(&self) -> Vec<String>; // Provided methods fn with_node<F, R>(&self, id: NodeId, f: F) -> Option<R> where F: FnOnce(&NodeRecord) -> R, Self: Sized { ... } fn with_relationship<F, R>(&self, id: RelationshipId, f: F) -> Option<R> where F: FnOnce(&RelationshipRecord) -> R, Self: Sized { ... } fn has_node(&self, id: NodeId) -> bool { ... } fn has_relationship(&self, id: RelationshipId) -> bool { ... } fn node_count(&self) -> usize { ... } fn relationship_count(&self) -> usize { ... } fn all_nodes(&self) -> Vec<NodeRecord> { ... } fn nodes_by_label(&self, label: &str) -> Vec<NodeRecord> { ... } fn all_relationships(&self) -> Vec<RelationshipRecord> { ... } fn relationships_by_type(&self, rel_type: &str) -> Vec<RelationshipRecord> { ... } fn relationship_ids_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipId> { ... } fn outgoing_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord> { ... } fn incoming_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord> { ... } fn relationships_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipRecord> { ... } fn degree(&self, node_id: NodeId, direction: Direction) -> usize { ... } fn is_isolated(&self, node_id: NodeId) -> bool { ... } fn expand( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipRecord, NodeRecord)> { ... } fn expand_detailed( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<ExpandedRelationship> { ... } fn neighbors( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<NodeRecord> { ... } fn node_has_label(&self, node_id: NodeId, label: &str) -> bool where Self: Sized { ... } fn node_labels(&self, node_id: NodeId) -> Option<Vec<String>> where Self: Sized { ... } fn node_properties(&self, node_id: NodeId) -> Option<Properties> where Self: Sized { ... } fn node_property(&self, node_id: NodeId, key: &str) -> Option<PropertyValue> where Self: Sized { ... } fn relationship_type(&self, rel_id: RelationshipId) -> Option<String> where Self: Sized { ... } fn relationship_properties( &self, rel_id: RelationshipId, ) -> Option<Properties> where Self: Sized { ... } fn relationship_property( &self, rel_id: RelationshipId, key: &str, ) -> Option<PropertyValue> where Self: Sized { ... } fn relationship_source(&self, rel_id: RelationshipId) -> Option<NodeId> { ... } fn relationship_target(&self, rel_id: RelationshipId) -> Option<NodeId> { ... } fn other_node( &self, rel_id: RelationshipId, node_id: NodeId, ) -> Option<NodeId> { ... } fn has_label_name(&self, label: &str) -> bool { ... } fn has_relationship_type_name(&self, rel_type: &str) -> bool { ... } fn all_node_property_keys(&self) -> Vec<String> where Self: Sized { ... } fn all_relationship_property_keys(&self) -> Vec<String> where Self: Sized { ... } fn all_property_keys(&self) -> Vec<String> where Self: Sized { ... } fn has_property_key(&self, key: &str) -> bool where Self: Sized { ... } fn label_property_keys(&self, label: &str) -> Vec<String> where Self: Sized { ... } fn rel_type_property_keys(&self, rel_type: &str) -> Vec<String> where Self: Sized { ... } fn label_has_property_key(&self, label: &str, key: &str) -> bool where Self: Sized { ... } fn rel_type_has_property_key(&self, rel_type: &str, key: &str) -> bool where Self: Sized { ... } fn find_nodes_by_property( &self, label: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<NodeRecord> where Self: Sized { ... } fn find_node_ids_by_property( &self, label: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<NodeId> where Self: Sized { ... } fn find_relationships_by_property( &self, rel_type: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<RelationshipRecord> where Self: Sized { ... } fn find_relationship_ids_by_property( &self, rel_type: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<RelationshipId> where Self: Sized { ... } fn node_exists_with_label_and_property( &self, label: &str, key: &str, value: &PropertyValue, ) -> bool where Self: Sized { ... } fn relationship_exists_with_type_and_property( &self, rel_type: &str, key: &str, value: &PropertyValue, ) -> bool where Self: Sized { ... }
}

Required Methods§

Source

fn contains_node(&self, id: NodeId) -> bool

Cheap existence check. Should not clone or materialize the record.

Source

fn node(&self, id: NodeId) -> Option<NodeRecord>

Point lookup returning an owned record. Backends that can hand out borrows should also implement BorrowedGraphStorage::node_ref and override [with_node] to avoid clones on the hot path.

Source

fn all_node_ids(&self) -> Vec<NodeId>

Enumerate every node id. Should be O(nodes) without cloning records.

Source

fn node_ids_by_label(&self, label: &str) -> Vec<NodeId>

Enumerate node ids carrying the given label. Implementations that keep a label index should override this.

Source

fn contains_relationship(&self, id: RelationshipId) -> bool

Source

fn relationship(&self, id: RelationshipId) -> Option<RelationshipRecord>

Source

fn all_rel_ids(&self) -> Vec<RelationshipId>

Source

fn rel_ids_by_type(&self, rel_type: &str) -> Vec<RelationshipId>

Source

fn relationship_endpoints(&self, id: RelationshipId) -> Option<(NodeId, NodeId)>

Endpoint pair (src, dst) for a relationship. Required because traversal uses it on hot paths; a backend that stores endpoints alongside the id index can answer this without fetching properties.

Source

fn expand_ids( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipId, NodeId)>

Expand a node’s incident relationships filtered by direction and (optional) types. This is the single traversal primitive; variable- length paths, degree, and adjacency helpers are all derived from it.

Source

fn all_labels(&self) -> Vec<String>

Source

fn all_relationship_types(&self) -> Vec<String>

Provided Methods§

Source

fn with_node<F, R>(&self, id: NodeId, f: F) -> Option<R>
where F: FnOnce(&NodeRecord) -> R, Self: Sized,

Source

fn with_relationship<F, R>(&self, id: RelationshipId, f: F) -> Option<R>
where F: FnOnce(&RelationshipRecord) -> R, Self: Sized,

Source

fn has_node(&self, id: NodeId) -> bool

Source

fn has_relationship(&self, id: RelationshipId) -> bool

Source

fn node_count(&self) -> usize

Source

fn relationship_count(&self) -> usize

Source

fn all_nodes(&self) -> Vec<NodeRecord>

Source

fn nodes_by_label(&self, label: &str) -> Vec<NodeRecord>

Source

fn all_relationships(&self) -> Vec<RelationshipRecord>

Source

fn relationships_by_type(&self, rel_type: &str) -> Vec<RelationshipRecord>

Source

fn relationship_ids_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipId>

Source

fn outgoing_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord>

Source

fn incoming_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord>

Source

fn relationships_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipRecord>

Source

fn degree(&self, node_id: NodeId, direction: Direction) -> usize

Source

fn is_isolated(&self, node_id: NodeId) -> bool

Source

fn expand( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipRecord, NodeRecord)>

Source

fn expand_detailed( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<ExpandedRelationship>

Source

fn neighbors( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<NodeRecord>

Source

fn node_has_label(&self, node_id: NodeId, label: &str) -> bool
where Self: Sized,

Source

fn node_labels(&self, node_id: NodeId) -> Option<Vec<String>>
where Self: Sized,

Source

fn node_properties(&self, node_id: NodeId) -> Option<Properties>
where Self: Sized,

Source

fn node_property(&self, node_id: NodeId, key: &str) -> Option<PropertyValue>
where Self: Sized,

Source

fn relationship_type(&self, rel_id: RelationshipId) -> Option<String>
where Self: Sized,

Source

fn relationship_properties(&self, rel_id: RelationshipId) -> Option<Properties>
where Self: Sized,

Source

fn relationship_property( &self, rel_id: RelationshipId, key: &str, ) -> Option<PropertyValue>
where Self: Sized,

Source

fn relationship_source(&self, rel_id: RelationshipId) -> Option<NodeId>

Source

fn relationship_target(&self, rel_id: RelationshipId) -> Option<NodeId>

Source

fn other_node(&self, rel_id: RelationshipId, node_id: NodeId) -> Option<NodeId>

Source

fn has_label_name(&self, label: &str) -> bool

Source

fn has_relationship_type_name(&self, rel_type: &str) -> bool

Source

fn all_node_property_keys(&self) -> Vec<String>
where Self: Sized,

Source

fn all_relationship_property_keys(&self) -> Vec<String>
where Self: Sized,

Source

fn all_property_keys(&self) -> Vec<String>
where Self: Sized,

Source

fn has_property_key(&self, key: &str) -> bool
where Self: Sized,

Source

fn label_property_keys(&self, label: &str) -> Vec<String>
where Self: Sized,

Source

fn rel_type_property_keys(&self, rel_type: &str) -> Vec<String>
where Self: Sized,

Source

fn label_has_property_key(&self, label: &str, key: &str) -> bool
where Self: Sized,

Source

fn rel_type_has_property_key(&self, rel_type: &str, key: &str) -> bool
where Self: Sized,

Source

fn find_nodes_by_property( &self, label: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<NodeRecord>
where Self: Sized,

Source

fn find_node_ids_by_property( &self, label: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<NodeId>
where Self: Sized,

Source

fn find_relationships_by_property( &self, rel_type: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<RelationshipRecord>
where Self: Sized,

Source

fn find_relationship_ids_by_property( &self, rel_type: Option<&str>, key: &str, value: &PropertyValue, ) -> Vec<RelationshipId>
where Self: Sized,

Source

fn node_exists_with_label_and_property( &self, label: &str, key: &str, value: &PropertyValue, ) -> bool
where Self: Sized,

Source

fn relationship_exists_with_type_and_property( &self, rel_type: &str, key: &str, value: &PropertyValue, ) -> bool
where Self: Sized,

Implementors§