@@ -0,0 +1,3034 @@
+/**%0A* GraphConverter example%0A*%0A* @author Eleftherios Anagnostopoulos%0A* @since 2014-12-15%0A*%0A*/%0A%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.util.ArrayList;%0Aimport java.util.Map;%0Aimport java.util.Scanner;%0A%0Apublic class GraphConverter extends MapReduceFramework%7B%0A%0A    public void map(final File fileEntry, Map%3CString, ArrayList%3CString%3E%3E map) %7B%0A        Scanner sc = null;%0A        String word = null;%0A        String key = %22%22;%0A        String value = %22%22;%0A        String temp = %22%22;%0A        Character c;%0A%0A        try %7B%0A            if (fileEntry.isFile()) %7B%0A                sc = new Scanner(fileEntry);%0A%0A                while (sc.hasNext()) %7B%0A                    word = sc.next();%0A%0A                    for (int i = 0; i %3C word.length(); i++) %7B%0A                        c = word.charAt(i);%0A%0A                        if (c == ',') %7B%0A                            key = temp;%0A                            temp = %22%22;%0A                        %7D%0A                        if ((c %3E= 'a' && c %3C= 'z') %7C%7C (c %3E= '0' && c %3C= '9')) %7B%0A                            temp = temp + c;%0A                        %7D%0A                    %7D%0A                    value = temp;%0A                    temp = %22%22;%0A%0A                    mapHelp(map, key, value);%0A                    mapHelp(map, value, key);%0A                %7D%0A                sc.close();%0A            %7D%0A        %7D%0A        catch (FileNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        finally %7B%0A            if (sc != null)%0A            sc.close();%0A        %7D%0A    %7D%0A%0A    public void mapHelp(Map%3CString, ArrayList%3CString%3E%3E map, String key, String value) %7B%0A        ArrayList%3CString%3E values = map.get(key);%0A%0A        if (values == null) %7B%0A            values = new ArrayList%3CString%3E();%0A            values.add(value);%0A            map.put(key, values);%0A        %7D%0A        else %7B%0A            if (!values.contains(value)) %7B%0A                values.add(value);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void reduce(String key, ArrayList%3CString%3E value) %7B%0A        String new_value = %22#%22;%0A        ArrayList%3CInteger%3E duplicates = new ArrayList%3CInteger%3E();%0A%0A        for (Integer i = 0; i %3C value.size(); i++) %7B%0A%0A            for (Integer j = i + 1; j %3C value.size(); j++) %7B%0A%0A                if (value.get(i).equals(value.get(j))) %7B%0A                    duplicates.add(j);%0A                %7D%0A            %7D%0A            if (!duplicates.contains(i)) %7B%0A                new_value = new_value + %22 %22 + value.get(i);%0A            %7D%0A        %7D%0A        synchronized (reducing_output) %7B%0A            reducing_output.put(key, new_value.toString());%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        if (args.length != 4) %7B%0A            System.err.println(%22Usage: java GraphConverter input_directory output_directory %22%0A                             + %22number_of_mapper_threads number_of_reducer_threads%22);%0A            System.exit(1);%0A        %7D%0A%0A        GraphConverter gc = new GraphConverter();%0A        gc.driver(args%5B0%5D, args%5B1%5D, Integer.parseInt(args%5B2%5D) , Integer.parseInt(args%5B3%5D));%0A    %7D%0A%7D%0A

Create GraphConverter.java