public void reduce(Text prefix, Iterator<Text> iter,
						   OutputCollector<Text, Text> output, Reporter reporter)
						   throws IOException
		{
            //Map<String, Node> nodes = new HashMap<String, Node>();
            List<Node> nodes = new ArrayList<Node>();
            Map<String, Node> nodes_fr = new HashMap<String, Node>();
			while(iter.hasNext())
			{
				String msg = iter.next().toString();

				String [] vals = msg.split("\t");

				if (vals[2].equals(Node.NODEMSG))
				{
                    Node node = new Node(vals[1]);
                    //node.fromNodeMsg(msg);
                    node.parseNodeMsg(vals, 2);
                    nodes_fr.put(node.getNodeId() + "|" + vals[0], node);
                    if (vals[0].equals("f")) {
                        //nodes.put(node.getNodeId(), node);
                        nodes.add(node);
                    }
				}
				else
				{
					throw new IOException("Unknown msgtype: " + msg);
				}
			}

            //Map<String, Node> Contained_Nodes = new HashMap<String, Node>();
            //Map<String, Node> Filter_Nodes = new HashMap<String, Node>();
            for (int i = 0; i < nodes.size(); i++) {
                Node node = nodes.get(i);
                for(String nodeid_dir : nodes_fr.keySet())
                {
                    //System.err.println(nodeid_dir + " XX");
                    String id = nodeid_dir.substring(0, nodeid_dir.indexOf("|"));
                    String dir = nodeid_dir.substring(nodeid_dir.indexOf("|")+1);
                    if (node.getNodeId().equals(id)) {
                        continue;
                    }
                    Node verify_node = nodes_fr.get(nodeid_dir);
                    String verify_str;
                    if (dir.equals("f")){
                        verify_str = verify_node.str();
                    } else {
                        verify_str = Node.rc(verify_node.str());
                    }


                    if (node.str().equals(verify_str)) {
                        if (node.getNodeId().compareTo(verify_node.getNodeId()) < 0) {
                            node.setCoverage(node.cov()+1);
                            node.addPairEnd(verify_node.getNodeId());
                        } else {
                            node.setCustom("n", "1"); // n = CONTAINED
                            reporter.incrCounter("Brush", "contained", 1);
                            break;
                        }
                    } else {
                       /* int distance = Node.getLevenshteinDistance(node.str(),verify_str);
                        if (node.str().length() > verify_str.length()) {
                            if ((float)distance/(float)node.str().length() < 0.03f) {
                                if (node.getNodeId().compareTo(verify_node.getNodeId()) < 0) {
                                    node.setCoverage(node.cov()+1);
                                    node.addPairEnd(verify_node.getNodeId());
                                } else {
                                    node.setCustom("n", "1"); // n = CONTAINED
                                    reporter.incrCounter("Brush", "contained", 1);
                                    break;
                                }
                            }
                        } else if (node.str().length() < verify_node.str().length()) {
                            if ((float)distance/(float)verify_node.str().length() < 0.03f) {
                                if (node.getNodeId().compareTo(verify_node.getNodeId()) < 0) {
                                    node.setCoverage(node.cov()+1);
                                } else {
                                    node.setCustom("n", "1"); // n = CONTAINED
                                    reporter.incrCounter("Brush", "contained", 1);
                                    break;
                                }
                            }

                        } else {
                            if ((float)distance/(float)node.str().length() < 0.03f) {
                                if (node.getNodeId().compareTo(verify_node.getNodeId()) < 0) {
                                    node.setCoverage(node.cov()+1);
                                } else {
                                    node.setCustom("n", "1"); // n = CONTAINED
                                    reporter.incrCounter("Brush", "contained", 1);
                                    break;
                                }
                            }
                        }*/
                    }
                    // for different length
                    /*if (node.str().length() > verify_str.length() && node.str().substring(0, verify_str.length()).equals(verify_str)){
                        node.setCoverage(node.cov()+1);
                    } else if (node.str().length() < verify_node.str().length() && verify_str.substring(0, node.str().length()).equals(node.str().length())) {
                        node.setCustom("n", "1"); // n = CONTAINED
                        break;
                    }*/
                }
                output.collect(new Text(node.getNodeId()), new Text(node.toNodeMsg()));
                reporter.incrCounter("Brush", "nodecount", 1);
            }


		}