pub struct BacklinkAnalyzer { /* private fields */ }Expand description
Analyzes internal link graphs and computes PageRank-like scores.
Implementations§
Source§impl BacklinkAnalyzer
impl BacklinkAnalyzer
Sourcepub fn add_link(&mut self, source: &str, target: &str)
pub fn add_link(&mut self, source: &str, target: &str)
Adds an internal link from source to target.
Both URLs should be normalized (e.g. trailing slash stripped). Fragments are automatically stripped.
Sourcepub fn add_backlink(&mut self, backlink: Backlink)
pub fn add_backlink(&mut self, backlink: Backlink)
Adds a backlink record (used for external backlink tracking).
Sourcepub fn load_from_crawl_data(&mut self, pages: &[(String, Vec<String>)])
pub fn load_from_crawl_data(&mut self, pages: &[(String, Vec<String>)])
Bulk-load internal links from crawl data.
pages should be a slice of (page_url, [link_urls]) tuples.
Sourcepub fn compute_pagerank(
&self,
damping: f64,
iterations: usize,
) -> HashMap<String, f64>
pub fn compute_pagerank( &self, damping: f64, iterations: usize, ) -> HashMap<String, f64>
Computes PageRank scores for all known URLs.
Uses the iterative PageRank algorithm with damping factor d.
Typically d = 0.85.
Sourcepub fn report_for_url(
&self,
url: &str,
pagerank_scores: &HashMap<String, f64>,
) -> BacklinkReport
pub fn report_for_url( &self, url: &str, pagerank_scores: &HashMap<String, f64>, ) -> BacklinkReport
Generates a backlink report for a specific URL.
Sourcepub fn summarize(&self) -> BacklinkSummary
pub fn summarize(&self) -> BacklinkSummary
Generates a full backlink summary for the entire site.
Sourcepub fn link_count(&self) -> usize
pub fn link_count(&self) -> usize
Returns the total number of internal links.
Sourcepub fn known_urls(&self) -> &HashSet<String>
pub fn known_urls(&self) -> &HashSet<String>
Returns the set of all known URLs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BacklinkAnalyzer
impl RefUnwindSafe for BacklinkAnalyzer
impl Send for BacklinkAnalyzer
impl Sync for BacklinkAnalyzer
impl Unpin for BacklinkAnalyzer
impl UnsafeUnpin for BacklinkAnalyzer
impl UnwindSafe for BacklinkAnalyzer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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