You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/examples_sphinx-gallery/personalized_pagerank.py
+21-6Lines changed: 21 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -8,19 +8,24 @@
8
8
This example demonstrates how to calculate and visualize personalized PageRank on a grid. We use the :meth:`igraph.Graph.personalized_pagerank` method, and demonstrate the effects on a grid graph.
9
9
"""
10
10
11
+
# %%
12
+
# .. note::
13
+
#
14
+
# The PageRank score of a vertex reflects the probability that a random walker will be at that vertex over the long run. At each step the walker has a 1 - damping chance to restart the walk and pick a starting vertex according to the probabilities defined in the reset vector.
15
+
16
+
importigraphasig
11
17
importmatplotlib.cmascm
12
18
importmatplotlib.pyplotasplt
13
19
importnumpyasnp
14
20
15
-
importigraphasig
16
-
17
-
18
21
# %%
19
22
# We define a function that plots the graph on a Matplotlib axis, along with
20
23
# its personalized PageRank values. The function also generates a
21
24
# color bar on the side to see how the values change.
22
25
# We use `Matplotlib's Normalize class <https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.Normalize.html>`_
23
26
# to set the colors and ensure that our color bar range is correct.
0 commit comments