I have used Java for coding of this project. For the first part, I have created a collection of general graph functions. The functions will apply to any graph, provided it is presented in the correct form. In the second part I will translate movie rating data from Netflix into graphs and analyze the graphs with the implemented functions.
I have implemented the following graph algorithms as operations :
- connected_components() : uses depth-first search to return the list of connected components.
- one_cycle(): uses depth-first search to return a cycle if there is one.
- shortest_paths(): uses Dijkstra’s algorithm and returns a map of shortest paths. As this is an un-weighted and un-directed graph, we have used BFS Algorithm to return path length from source to destination.
I have used the following graph structures to generate simulated data and to test them with the operations from above :
- n-cycle
- A complete graph on n vertices
- An empty graph on n vertices
- A heap
- Equivalence mod k