pub struct RawGraph {
pub graph: DiGraph<String, ()>,
pub node_map: HashMap<String, NodeIndex>,
pub content_hash: String,
}Expand description
A directed dependency graph built from SQLite.
Nodes are item IDs (strings). An edge A → B means “A blocks B”.
RawGraph preserves all edges as stored in the projection database,
including any cycles that may exist due to concurrent or inconsistent
link events. Use crate::graph::normalize to condense SCCs and
optionally reduce transitive edges.
Fields§
§graph: DiGraph<String, ()>Directed graph: nodes = item IDs, edges = blocking relationships.
node_map: HashMap<String, NodeIndex>Mapping from item ID to petgraph NodeIndex.
content_hash: StringBLAKE3 content hash of the edge set used for cache invalidation.
Implementations§
Source§impl RawGraph
impl RawGraph
Sourcepub fn from_sqlite(conn: &Connection) -> Result<Self>
pub fn from_sqlite(conn: &Connection) -> Result<Self>
Build a RawGraph by querying item_dependencies in conn.
Only rows where link_type IN ('blocks', 'blocked_by') are used.
All non-deleted items from the items table are included as nodes
(even those with no dependencies) so downstream metrics see the
full node set.
The content hash is derived from the sorted list of (blocker, blocked)
pairs, so it changes only when edges change.
§Errors
Returns an error if the SQLite query fails.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes (items) in the graph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Return the number of edges (blocking relationships) in the graph.
Sourcepub fn node_index(&self, item_id: &str) -> Option<NodeIndex>
pub fn node_index(&self, item_id: &str) -> Option<NodeIndex>
Look up the NodeIndex for an item ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RawGraph
impl RefUnwindSafe for RawGraph
impl Send for RawGraph
impl Sync for RawGraph
impl Unpin for RawGraph
impl UnsafeUnpin for RawGraph
impl UnwindSafe for RawGraph
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.