ICP 09 : Apache Spark Practice - acikgozmehmet/BigDataProgramming GitHub Wiki

ICP 09 : Apache Spark Practice

In class exercise:

Please feel free to click on the link to reach the source code

1. Merge Sort Algorithm

Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge () function is used for merging two halves. The merge (arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.

Create a Map-Reduce Program to perform Merge-Sort Algorithm in Spark.

Output:

2. DepthFirst Search

The depth-first search algorithm allows us to determine whether two nodes, node x and node y, have a path between them. The DFS algorithm does this by looking at all of the children of the starting node, node x, until it reaches node y. It does this by recursively taking the same steps, again and again, in order to determine if such a path between two nodes even exists.

Implement Depth First Search in Graph in Apache Spark

Output:

References:

https://medium.com/basecs/deep-dive-through-a-graph-dfs-traversal-8177df5d0f13

https://spark.apache.org/docs/latest/rdd-programming-guide.html