PageRank estimates node importance from incoming connections, weighting both their quantity and the importance of the nodes supplying them. It supports graph exploration, influence analysis, and fraud detection. section 10.1.7 section 6.2
A practical PageRank workflow distinguishes two views:
- Compute base PageRank with all connections treated equally to estimate general network importance. section 10.1.7
- Compute fraud-weighted PageRank by emphasizing known fraudulent nodes, then compare scores to identify nodes warranting investigation. section 10.1.7
Fraud-network comparison
Node A has the highest base PageRank at 0.108, while node D leads fraud-weighted PageRank at 0.168; the divergence reveals stronger links to fraudulent activity than overall network position suggests. section 10.1.7
Listing 10.9 Computing PageRank variations for fraud detection
import networkx as nx
import numpy as np
def compute_pagerank_metrics(G, fraud_weight=2.0, damping_factor=0.85):
pagerank_metrics = {} #1
base_pagerank = nx.pagerank(
G,
alpha=damping_factor,
personalization=None,
weight=None
) #2
fraud_personalization = {}
for node in G.nodes(): #3
if G.nodes[node].get('is_fraudster', False):
fraud_personalization[node] = fraud_weight
else:
fraud_personalization[node] = 1.0
fraud_pagerank = nx.pagerank(
G,
alpha=damping_factor,
personalization=fraud_personalization,
weight=None
) #4
for node in G.nodes():
pagerank_metrics[node] = {
'pagerank_base': round(base_pagerank[node], 3),
'pagerank_fraud': round(fraud_pagerank[node], 3)
} #5
return pagerank_metrics #6
def get_node_pagerank(G, node):
metrics = compute_pagerank_metrics(G)
return metrics.get(node, {
'pagerank_base': 0.0,
'pagerank_fraud': 0.0
}) #7
Inspect the NetworkX implementation for damping, personalization, fraud weighting, and per-node metric output. section 10.1.7


