pub struct RandomWalkGenerator<N: Node> { /* private fields */ }Expand description
Random walk generator for graphs
Implementations§
Source§impl<N: Node> RandomWalkGenerator<N>
impl<N: Node> RandomWalkGenerator<N>
Sourcepub fn simple_random_walk<E, Ix>(
&mut self,
graph: &Graph<N, E, Ix>,
start: &N,
length: usize,
) -> Result<RandomWalk<N>>
pub fn simple_random_walk<E, Ix>( &mut self, graph: &Graph<N, E, Ix>, start: &N, length: usize, ) -> Result<RandomWalk<N>>
Generate a simple random walk from a starting node (undirected graph)
Sourcepub fn simple_random_walk_digraph<E, Ix>(
&mut self,
graph: &DiGraph<N, E, Ix>,
start: &N,
length: usize,
) -> Result<RandomWalk<N>>
pub fn simple_random_walk_digraph<E, Ix>( &mut self, graph: &DiGraph<N, E, Ix>, start: &N, length: usize, ) -> Result<RandomWalk<N>>
Generate a simple random walk on a directed graph (follows outgoing edges)
Sourcepub fn node2vec_walk<E, Ix>(
&mut self,
graph: &Graph<N, E, Ix>,
start: &N,
length: usize,
p: f64,
q: f64,
) -> Result<RandomWalk<N>>
pub fn node2vec_walk<E, Ix>( &mut self, graph: &Graph<N, E, Ix>, start: &N, length: usize, p: f64, q: f64, ) -> Result<RandomWalk<N>>
Generate a Node2Vec biased random walk (undirected graph)
Uses biased second-order random walks controlled by parameters p and q:
- p: Return parameter. Higher p makes it less likely to return to the previous node.
- q: In-out parameter. Higher q biases towards nodes close to the previous node (BFS-like). Lower q biases towards unexplored nodes (DFS-like).
Sourcepub fn node2vec_walk_digraph<E, Ix>(
&mut self,
graph: &DiGraph<N, E, Ix>,
start: &N,
length: usize,
p: f64,
q: f64,
) -> Result<RandomWalk<N>>
pub fn node2vec_walk_digraph<E, Ix>( &mut self, graph: &DiGraph<N, E, Ix>, start: &N, length: usize, p: f64, q: f64, ) -> Result<RandomWalk<N>>
Generate a Node2Vec biased random walk on a directed graph
Follows outgoing edges with the same p,q bias scheme as the undirected version.
Sourcepub fn generate_walks<E, Ix>(
&mut self,
graph: &Graph<N, E, Ix>,
start: &N,
num_walks: usize,
walk_length: usize,
) -> Result<Vec<RandomWalk<N>>>
pub fn generate_walks<E, Ix>( &mut self, graph: &Graph<N, E, Ix>, start: &N, num_walks: usize, walk_length: usize, ) -> Result<Vec<RandomWalk<N>>>
Generate multiple random walks from a starting node
Sourcepub fn generate_walks_digraph<E, Ix>(
&mut self,
graph: &DiGraph<N, E, Ix>,
start: &N,
num_walks: usize,
walk_length: usize,
) -> Result<Vec<RandomWalk<N>>>
pub fn generate_walks_digraph<E, Ix>( &mut self, graph: &DiGraph<N, E, Ix>, start: &N, num_walks: usize, walk_length: usize, ) -> Result<Vec<RandomWalk<N>>>
Generate multiple random walks from a starting node on a directed graph
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for RandomWalkGenerator<N>
impl<N> !RefUnwindSafe for RandomWalkGenerator<N>
impl<N> !Send for RandomWalkGenerator<N>
impl<N> !Sync for RandomWalkGenerator<N>
impl<N> Unpin for RandomWalkGenerator<N>where
N: Unpin,
impl<N> UnsafeUnpin for RandomWalkGenerator<N>
impl<N> !UnwindSafe for RandomWalkGenerator<N>
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