pub struct PageRankAnalysis { /* private fields */ }Expand description
Main entry point for PageRank centrality analysis
This is the primary interface for computing PageRank centrality scores and integrating them with the FastPath heuristic system.
§Examples
ⓘ
use scribe_graph::PageRankAnalysis;
let analysis = PageRankAnalysis::new()?;
let scan_results = vec![
MockScanResult { path: "main.rs".to_string(), relative_path: "main.rs".to_string() },
MockScanResult { path: "lib.rs".to_string(), relative_path: "lib.rs".to_string() },
];
let centrality_results = analysis.compute_centrality(&scan_results)?;
// Get files ranked by importance
let top_files = centrality_results.top_files_by_centrality(10);
println!("Top 10 most important files:");
for (file, score) in top_files {
println!(" {}: {:.4}", file, score);
}Implementations§
Source§impl PageRankAnalysis
impl PageRankAnalysis
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new PageRank analysis instance with default configuration
Sourcepub fn with_config(config: CentralityConfig) -> Result<Self>
pub fn with_config(config: CentralityConfig) -> Result<Self>
Create with custom centrality configuration
Sourcepub fn for_code_analysis() -> Result<Self>
pub fn for_code_analysis() -> Result<Self>
Create optimized for code dependency analysis
Sourcepub fn for_large_codebases() -> Result<Self>
pub fn for_large_codebases() -> Result<Self>
Create optimized for large codebases (>5k files)
Sourcepub fn compute_centrality<T>(
&self,
scan_results: &[T],
) -> Result<CentralityResults>where
T: ScanResult + Sync,
pub fn compute_centrality<T>(
&self,
scan_results: &[T],
) -> Result<CentralityResults>where
T: ScanResult + Sync,
Compute PageRank centrality scores for a collection of files
Sourcepub fn integrate_with_heuristics(
&self,
centrality_results: &CentralityResults,
heuristic_scores: &HashMap<String, f64>,
) -> Result<HashMap<String, f64>>
pub fn integrate_with_heuristics( &self, centrality_results: &CentralityResults, heuristic_scores: &HashMap<String, f64>, ) -> Result<HashMap<String, f64>>
Integrate centrality scores with existing heuristic scores
This combines PageRank centrality with FastPath heuristic scores using configurable weights. The default configuration uses 15% centrality weight and 85% heuristic weight.
Sourcepub fn summarize_results(&self, results: &CentralityResults) -> String
pub fn summarize_results(&self, results: &CentralityResults) -> String
Get a summary of centrality computation results
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PageRankAnalysis
impl RefUnwindSafe for PageRankAnalysis
impl Send for PageRankAnalysis
impl Sync for PageRankAnalysis
impl Unpin for PageRankAnalysis
impl UnwindSafe for PageRankAnalysis
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
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>
Converts
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>
Converts
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