pub struct BlastRadius {
pub direct: u32,
pub transitive: u32,
pub score: f32,
pub tier: BlastTier,
}Fields§
§direct: u32Number of files that directly import this file (1 hop via Imports edges).
transitive: u32Number of files that transitively import this file within TRANSITIVE_DEPTH, excluding direct importers. Deduplicated across all paths.
score: f32Weighted score: direct + (transitive * TRANSITIVE_WEIGHT). Higher means more dangerous to modify.
tier: BlastTierCategorical tier for agent-friendly consumption.
Implementations§
Source§impl BlastRadius
impl BlastRadius
Sourcepub fn compute(file_key: &str, graph: &Graph) -> Self
pub fn compute(file_key: &str, graph: &Graph) -> Self
Compute blast radius for a single file given the graph.
Uses neighbors_incoming with EdgeKind::Imports at depth 1 for direct
count, and traverse_incoming at TRANSITIVE_DEPTH for the full
transitive set. Transitive count excludes direct importers.
Prefer Self::compute_all for batch computation — it’s O(V+E) total
vs O(N*(V+E)) when calling this in a loop.
Sourcepub fn compute_all(
graph: &Graph,
file_keys: &[String],
) -> HashMap<String, BlastRadius>
pub fn compute_all( graph: &Graph, file_keys: &[String], ) -> HashMap<String, BlastRadius>
Compute blast radius for every file in the graph in a single pass.
Returns a map from file:<path> keys to their BlastRadius.
Pre-computes the reverse adjacency list once, then runs bounded BFS
per node. This avoids repeated edges_directed lookups in petgraph,
reducing constant factors significantly on large graphs.
Trait Implementations§
Source§impl Clone for BlastRadius
impl Clone for BlastRadius
Source§fn clone(&self) -> BlastRadius
fn clone(&self) -> BlastRadius
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BlastRadius
impl Debug for BlastRadius
Source§impl<'de> Deserialize<'de> for BlastRadius
impl<'de> Deserialize<'de> for BlastRadius
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>,
Source§impl PartialEq for BlastRadius
impl PartialEq for BlastRadius
Source§fn eq(&self, other: &BlastRadius) -> bool
fn eq(&self, other: &BlastRadius) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BlastRadius
impl Serialize for BlastRadius
impl StructuralPartialEq for BlastRadius
Auto Trait Implementations§
impl Freeze for BlastRadius
impl RefUnwindSafe for BlastRadius
impl Send for BlastRadius
impl Sync for BlastRadius
impl Unpin for BlastRadius
impl UnsafeUnpin for BlastRadius
impl UnwindSafe for BlastRadius
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for 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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more