pub struct RandomWalkPe {
pub walk_length: usize,
pub projection: Array2<f64>,
pub pe_dim: usize,
}Expand description
Random Walk Positional Encoding (RWPE).
Computes the diagonal of P^k for k=1..K where P is the random walk transition matrix. The landing probabilities R_ii = (P^k)_ii encode local structural information around each node.
Fields§
§walk_length: usizeNumber of random walk steps (K)
projection: Array2<f64>Linear projection: [walk_length, pe_dim]
pe_dim: usizeOutput PE dimension
Implementations§
Source§impl RandomWalkPe
impl RandomWalkPe
Sourcepub fn new(walk_length: usize, pe_dim: usize) -> Self
pub fn new(walk_length: usize, pe_dim: usize) -> Self
Create a new RWPE module.
§Arguments
walk_length- Number of random walk steps Kpe_dim- Output dimension for the positional encoding
Sourcepub fn compute_landing_probs(&self, adj: &CsrMatrix) -> Array2<f64>
pub fn compute_landing_probs(&self, adj: &CsrMatrix) -> Array2<f64>
Compute random walk landing probabilities.
Returns [n, walk_length] where entry (i, k) = (P^{k+1})_{ii}.
Trait Implementations§
Source§impl Clone for RandomWalkPe
impl Clone for RandomWalkPe
Source§fn clone(&self) -> RandomWalkPe
fn clone(&self) -> RandomWalkPe
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RandomWalkPe
impl RefUnwindSafe for RandomWalkPe
impl Send for RandomWalkPe
impl Sync for RandomWalkPe
impl Unpin for RandomWalkPe
impl UnsafeUnpin for RandomWalkPe
impl UnwindSafe for RandomWalkPe
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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