Graph Algorithm Research Internship

June 1, 2023

During my internship under the guidance of Professor Rupesh Nasre from the Indian Institute of Technology, Madras, I had the opportunity to work on several graph algorithms. This experience enhanced my understanding of algorithmic theory and allowed me to translate concepts to Python concepts. I also did a time-complexity analysis of algorithms, helping me understand their efficiency and scalability.

Most datasets were sourced from Stanford-SNAP, a collection of large datasets, and the time module was used to measure the time taken for the algorithms to run.

Gale-Shapley Algorithm

Gale-Shapley Algorithm, also known as the Stable Matching Algorithm, is used to find a match between two sets without violating the stability criteria. Despite being quadratic, it is fairly efficient for medium-sized sets.

Dijkstra's Algorithm

Dijkstra's Algorithm is used for finding the shortest path between two nodes in a graph. It is widely used in network routing and pathfinding. I implemented the algorithm in Python, using a greedy approach to iteratively explore the node with the least distance.

NodesEdgesTime (seconds)
3 78324 1861,73237
5 88135 5921,58963
7 115103 6891,33088
55 863858 49044,15523
75 879508 837216,67614
81 3061 768 149190,54480
107 61413 673 453207,79644
325 7291 497 1341 138,22747
685 2307 600 595est. 68 400
1 791 48928 511 807est. 561 600
While Dijkstra's algorithm typically has a time complexity of O(E + N log N), my Python implementation followed an O(N^2) pattern.

Max-Flow Computation

The Ford-Fulkerson algorithm computes the maximum flow in a flow network by iteratively finding augmenting paths from the source node to the sink node and updating the residual capacities. This is done until no more augmenting paths are found (and the flow is maximised).

I implemented the algorithm using a Breadth First Search approach to find the shortest augmenting path.

NodesEdgesTime (seconds)
1411600,00009274482727
10 68024 3160,00515127182
1 2262 6150,8591217995
3 78324 1863,224216223
23 37033 1013,954843283
14 27420 5738,447390079
7 115103 68910,03473
5 88135 592107,632529
24 818506 550> 2 hours
55 863858 490> 2 hours
38 74158 595> 2 hours

My implementation had a time complexity of O(f * E), where f is the maximum flow and E is the number of edges in the graph.