pub struct EntityGraph {
pub nodes: HashMap<String, EntityNode>,
pub edges: Vec<RelationshipEdge>,
pub indexes: GraphIndexes,
pub metadata: GraphMetadata,
}Expand description
Entity relationship graph.
Fields§
§nodes: HashMap<String, EntityNode>All nodes in the graph
edges: Vec<RelationshipEdge>All edges in the graph
indexes: GraphIndexesGraph indexes for efficient lookups
metadata: GraphMetadataGraph metadata
Implementations§
Source§impl EntityGraph
impl EntityGraph
Sourcepub fn add_node(&mut self, node: EntityNode)
pub fn add_node(&mut self, node: EntityNode)
Add a node to the graph.
Sourcepub fn add_edge(&mut self, edge: RelationshipEdge)
pub fn add_edge(&mut self, edge: RelationshipEdge)
Add an edge to the graph.
Sourcepub fn get_node(&self, entity_id: &GraphEntityId) -> Option<&EntityNode>
pub fn get_node(&self, entity_id: &GraphEntityId) -> Option<&EntityNode>
Get a node by entity ID.
Sourcepub fn get_outgoing_edges(
&self,
entity_id: &GraphEntityId,
) -> Vec<&RelationshipEdge>
pub fn get_outgoing_edges( &self, entity_id: &GraphEntityId, ) -> Vec<&RelationshipEdge>
Get outgoing edges from a node.
Sourcepub fn get_incoming_edges(
&self,
entity_id: &GraphEntityId,
) -> Vec<&RelationshipEdge>
pub fn get_incoming_edges( &self, entity_id: &GraphEntityId, ) -> Vec<&RelationshipEdge>
Get incoming edges to a node.
Sourcepub fn get_edges_by_type(
&self,
rel_type: RelationshipType,
) -> Vec<&RelationshipEdge>
pub fn get_edges_by_type( &self, rel_type: RelationshipType, ) -> Vec<&RelationshipEdge>
Get edges by relationship type.
Sourcepub fn get_nodes_by_type(
&self,
entity_type: GraphEntityType,
) -> Vec<&EntityNode>
pub fn get_nodes_by_type( &self, entity_type: GraphEntityType, ) -> Vec<&EntityNode>
Get all nodes of a specific type.
Sourcepub fn get_neighbors(&self, entity_id: &GraphEntityId) -> Vec<&EntityNode>
pub fn get_neighbors(&self, entity_id: &GraphEntityId) -> Vec<&EntityNode>
Find neighbors of a node (nodes connected by edges).
Sourcepub fn node_degree(&self, entity_id: &GraphEntityId) -> usize
pub fn node_degree(&self, entity_id: &GraphEntityId) -> usize
Calculate the degree of a node (total edges in + out).
Sourcepub fn rebuild_indexes(&mut self)
pub fn rebuild_indexes(&mut self)
Rebuild indexes (call after deserialization).
Sourcepub fn statistics(&self) -> GraphStatistics
pub fn statistics(&self) -> GraphStatistics
Get graph statistics.
Trait Implementations§
Source§impl Clone for EntityGraph
impl Clone for EntityGraph
Source§fn clone(&self) -> EntityGraph
fn clone(&self) -> EntityGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityGraph
impl Debug for EntityGraph
Source§impl Default for EntityGraph
impl Default for EntityGraph
Source§fn default() -> EntityGraph
fn default() -> EntityGraph
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EntityGraph
impl<'de> Deserialize<'de> for EntityGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EntityGraph
impl RefUnwindSafe for EntityGraph
impl Send for EntityGraph
impl Sync for EntityGraph
impl Unpin for EntityGraph
impl UnwindSafe for EntityGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more