Time for action – the fourth and last run
Let's perform the fourth execution to validate that the output has now reached its final stable state.
Execute the MapReduce job:
$ hadoop jar graph.jarGraphPathgraphout3graphout4
Examine the output file:
$ hadoop fs -cat /user/hadoop/graphout4/part-r-00000 12,3,40D 21,41D 31,5,61D 41,21D 53,62D 63,52D 76-1P
What just happened?
The output is as expected; since node 7 is not reachable by node 1 or any of its neighbors, it will remain Pending and never be processed further. Consequently, our graph is unchanged as shown in the following figure:
The one thing we did not build into our algorithm was an understanding of a terminating condition; the process is complete if a run does not create any new D or C nodes.
The mechanism we use here is manual, that is, we knew by examination that the graph representation had reached its final stable state. There are ways of doing this programmatically, however. In a later chapter, we will discuss custom job counters...