@@ -43,10 +43,10 @@ def transition_from_adjacency(
43
43
This function generates a transition matrix from an adjacency matrix
44
44
using the following steps:
45
45
46
- 1. Add self-loop to the adjaency matrix if self_loop is set to True
47
- 2. Compute the degree matrix
46
+ 1. Add self-loop to the adjacency matrix if `` self_loop`` is set to `` True``.
47
+ 2. Compute the degree matrix.
48
48
3. Compute the transition matrix by taking the dot product of the inverse of
49
- the degree matrix and the adjacency matrix
49
+ the degree matrix and the adjacency matrix.
50
50
51
51
Parameters
52
52
----------
@@ -55,7 +55,7 @@ def transition_from_adjacency(
55
55
sub_sampling : float, default=0.1
56
56
The rate of subsampling.
57
57
self_loop : bool, default=True
58
- A flag indicating whether to add self-loop to the adjacency matrix.
58
+ Whether to add self-loops to the adjacency matrix.
59
59
60
60
Returns
61
61
-------
@@ -64,7 +64,6 @@ def transition_from_adjacency(
64
64
65
65
Examples
66
66
--------
67
- >>> import numpy as np
68
67
>>> A = np.array([[0, 1, 1, 0], [1, 0, 1, 0], [1, 1, 0, 1], [0, 0, 1, 0]])
69
68
>>> transition_from_adjacency(A)
70
69
array([[0.33333333, 0.33333333, 0.33333333, 0. ],
@@ -165,7 +164,6 @@ def random_walk(
165
164
166
165
Examples
167
166
--------
168
- >>> import numpy as np
169
167
>>> transition_matrix = np.array(
170
168
... [
171
169
... [0.0, 1.0, 0.0, 0.0],
@@ -175,10 +173,9 @@ def random_walk(
175
173
... ]
176
174
... )
177
175
>>> states = ["A", "B", "C", "D"]
178
- >>> walks = random_walk(
176
+ >>> random_walk(
179
177
... length=3, num_walks=2, states=states, transition_matrix=transition_matrix
180
178
... )
181
- >>> print(walks)
182
179
[['B', 'C', 'D'], ['B', 'C', 'B']]
183
180
"""
184
181
rw = RandomWalk (states , transition_matrix )
0 commit comments