I don't think can be done in a single map/reduce pass. Here the author discusses an implementation in PIG: http://techblug.wordpress.com/2011/08/07/transitive-closure-in-pig/ john
From: parnab kumar [mailto:parnab.2...@gmail.com] Sent: Thursday, June 13, 2013 10:42 PM To: user@hadoop.apache.org Subject: how to design the mapper and reducer for the below problem Consider a following input file of format : input File : 1 2 2 3 3 4 6 7 7 9 10 11 The output Should be as follows : 1 2 3 4 6 7 9 10 11