Skip to main content

RawGraph

Struct RawGraph 

Source
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: String

BLAKE3 content hash of the edge set used for cache invalidation.

Implementations§

Source§

impl RawGraph

Source

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.

Source

pub fn node_count(&self) -> usize

Return the number of nodes (items) in the graph.

Source

pub fn edge_count(&self) -> usize

Return the number of edges (blocking relationships) in the graph.

Source

pub fn node_index(&self, item_id: &str) -> Option<NodeIndex>

Look up the NodeIndex for an item ID.

Source

pub fn item_id(&self, idx: NodeIndex) -> Option<&str>

Return the item ID label for a node.

Trait Implementations§

Source§

impl Debug for RawGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more