Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write an R program to calculate the PageRank of nodes in a graph using an iterative method.

Hard

Problem Statement

Write an R program to calculate the PageRank of nodes in a graph using an iterative method.

Sample Input

Adjacency Matrix: 
 [,1] [,2] [,3]
[1,] 0 1 1
[2,] 1 0 1
[3,] 1 1 0

Sample Output

PageRank Scores: 0.3333 0.3333 0.3333

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
calculate_pagerank <- function(adj_matrix, damping_factor, tol) { # Your logic here } # Call the function
Log in or sign up to run or submit your code.Log inSign up
Input
Adjacency Matrix: 
 [,1] [,2] [,3]
[1,] 0 1 1
[2,] 1 0 1
[3,] 1 1 0
Expected Output
PageRank Scores: 0.3333 0.3333 0.3333