-
-
Couldn't load subscription status.
- Fork 342
Random walk restart #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Random walk restart #278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements the Random Walk with Restart (RWR) algorithm, a graph-based ranking method that computes node relevance scores by simulating a random walker that probabilistically restarts at a source node.
Key Changes:
- Adds RWR algorithm implementation in
random_walk_restart.r - Includes multiple graph algorithm implementations (Kruskal's MST, Dijkstra, BFS/DFS, Floyd-Warshall, etc.)
- Adds dynamic programming solutions (Knapsack, LCS, LIS, etc.)
- Includes documentation files for machine learning algorithms
Reviewed Changes
Copilot reviewed 142 out of 222 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
graph_algorithms/random_walk_restart.r |
Implements RWR algorithm with example usage |
graph_algorithms/kruskal_mst.r |
Kruskal's MST with Union-Find structure |
graph_algorithms/dijkstra_shortest_path.r |
Dijkstra's algorithm with priority queue |
graph_algorithms/floyd_warshall.r |
All-pairs shortest path using R6 class |
graph_algorithms/breadth_first_search.r |
BFS implementation with path finding |
graph_algorithms/depth_first_search.r |
Recursive and iterative DFS |
dynamic_programming/longest_increasing_subsequence.r |
O(n²) and O(n log n) LIS solutions |
dynamic_programming/0/1_knapsack_problem.r |
Classic 0/1 Knapsack DP solution |
documentation/*.md |
Machine learning documentation files |
machine_learning/README.md |
Tutorial links for ML in R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed 222 files, check your changes
Algorithm: Random Walk with Restart (RWR)
Purpose: Computes relevance scores of nodes in a graph based on a random walker that restarts at a source node with a fixed probability.
Theory:
Represents graph as adjacency matrix.
At each step, walker either moves to a neighbor or restarts at source.
Iterates until probability vector converges.
Time Complexity: O(max_iter * V²) for adjacency matrix multiplication.
Space Complexity: O(V²) for adjacency matrix.
Input: Adjacency matrix, restart probability, source node, max iterations, tolerance.
Output: Vector of steady-state probabilities representing node relevance.