pub struct PageRank;Expand description
PageRank algorithm implementation.
PageRank assigns importance scores to nodes based on the link structure of the graph. Nodes with many incoming links from important nodes will have higher scores.
Implementations§
Source§impl PageRank
impl PageRank
Sourcepub fn compute<T: Transaction>(
tx: &T,
config: &PageRankConfig,
) -> GraphResult<PageRankResult>
pub fn compute<T: Transaction>( tx: &T, config: &PageRankConfig, ) -> GraphResult<PageRankResult>
Compute PageRank scores for all nodes in the graph.
§Arguments
tx- The transaction to use for graph accessconfig- Configuration parameters for the algorithm
§Returns
A PageRankResult containing scores for all nodes.
§Algorithm
Uses the iterative power method:
- Initialize all nodes with score 1/N
- Iteratively update scores based on incoming links
- Handle dangling nodes (nodes with no outgoing edges)
- Check for convergence after each iteration
Sourcepub fn compute_for_nodes<T: Transaction>(
tx: &T,
nodes: &[EntityId],
config: &PageRankConfig,
) -> GraphResult<PageRankResult>
pub fn compute_for_nodes<T: Transaction>( tx: &T, nodes: &[EntityId], config: &PageRankConfig, ) -> GraphResult<PageRankResult>
Compute PageRank for a subset of nodes.
This is useful for computing PageRank on a subgraph defined by a specific set of nodes.
§Arguments
tx- The transaction to use for graph accessnodes- The nodes to include in the computationconfig- Configuration parameters for the algorithm
Auto Trait Implementations§
impl Freeze for PageRank
impl RefUnwindSafe for PageRank
impl Send for PageRank
impl Sync for PageRank
impl Unpin for PageRank
impl UnsafeUnpin for PageRank
impl UnwindSafe for PageRank
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