sksfa.utils.randomWalkFromCSC

sksfa.utils.randomWalkFromCSC(csc_matrix, n_steps=10, starting_node=None, restart_rate=0)[source]

This method produces an index trajectory on a graph by random walk, when the adjacency matrix is given in Compressed Sparse Column (CSC) Matrix format as implemented by scipy. The trajectory can be used to emulate spectral embeddings with SFA.

Parameters
osc_matrixsparse matrix (csc) of shape (n_nodes, n_nodes)

This CSC matrix should contain the adjacency matrix of a graph.

n_stepsint, default=10

The number of overall steps of the random walk.

starting_nodeint or None, (default None)

The index of the node from where to start the random walk. If None :

A random node will be sampled between 0 and the maximum node index.

restart_rateint, default=0

After which step will the random walk be restarted from a random node. This can be used to get better coverage of a graph with large diameter. If 0 :

The trajectory will be generated by one consecutive random walk.

Examples using sksfa.utils.randomWalkFromCSC