Modify mergeWithKmer to mergeWithNode
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/EdgeListWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/EdgeListWritable.java
index 3029d27..0954cde 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/EdgeListWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/EdgeListWritable.java
@@ -245,6 +245,15 @@
     }
     
     
+    public boolean contains(VKmerBytesWritable toFind){
+        Iterator<VKmerBytesWritable> posIterator = this.getKeys();
+        while (posIterator.hasNext()) {
+            if (toFind.equals(posIterator.next()))
+                return true;
+        }
+        return false;
+    }
+    
     /*
      * remove the first instance of `toRemove`. Uses a linear scan. Throws an
      * exception if not in this list.
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
index 68743cc..1cbf196 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
@@ -357,7 +357,7 @@
     /**
      * merge my edge list (both kmers and readIDs) with those of `other`.  Assumes that `other` is doing the flipping, if any.
      */
-    private void mergeEdges(byte dir, NodeWritable other) {
+    public void mergeEdges(byte dir, NodeWritable other) {
         switch (dir & DirectionFlag.DIR_MASK) {
             case DirectionFlag.DIR_FF:
                 if (outDegree() > 1)
diff --git a/genomix/genomix-hadoop/data/webmap/PathMerge_TestSet/head_7/7 b/genomix/genomix-hadoop/data/webmap/PathMerge_TestSet/head_7/7
new file mode 100644
index 0000000..6e72ddd
--- /dev/null
+++ b/genomix/genomix-hadoop/data/webmap/PathMerge_TestSet/head_7/7
@@ -0,0 +1,2 @@
+1	AAATAGAACC
+2	CCATAGAAGG
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTestSuite.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTestSuite.java
index 00b29fd..52be43a 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTestSuite.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTestSuite.java
@@ -24,7 +24,7 @@
     private static int SIZE_KMER = 3;
     public static final String PreFix = "data/webmap/PathMerge_TestSet"; 
     public static final String[] TestDir = { PreFix + File.separator
-        + "head_6"};
+        + "head_7"};
 //        + "2", PreFix + File.separator
 //        + "3", PreFix + File.separator
 //        + "4", PreFix + File.separator
diff --git a/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/.part-00000.crc b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/.part-00000.crc
new file mode 100644
index 0000000..70530d5
--- /dev/null
+++ b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/.part-00000.crc
Binary files differ
diff --git a/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/part-00000 b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/part-00000
new file mode 100755
index 0000000..485b0a4
--- /dev/null
+++ b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/bin/part-00000
Binary files differ
diff --git a/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/graphviz/result.ps b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/graphviz/result.ps
new file mode 100644
index 0000000..b84114c
--- /dev/null
+++ b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/graphviz/result.ps
@@ -0,0 +1,1188 @@
+%!PS-Adobe-3.0
+%%Creator: graphviz version 2.26.3 (20100126.1600)
+%%Title: G
+%%Pages: (atend)
+%%BoundingBox: (atend)
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+       dup 1 exch div /InvScaleFactor exch def
+       scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw text fitted to its expected width
+/alignedtext {			% width text
+	/text exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			[] 0 setdash
+			text stringwidth pop width exch sub text length div 0 text ashow
+		} if
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+setupLatin1
+%%Page: 1 1
+%%PageBoundingBox: 36 36 1118 336
+%%PageOrientation: Portrait
+0 0 1 beginpage
+gsave
+36 36 1082 300 boxprim clip newpath
+1 1 set_scale 0 rotate 40 41 translate
+% AAA
+gsave
+0 0 0.75294 nodecolor
+newpath 0 112 moveto
+0 216 lineto
+56 216 lineto
+56 112 lineto
+closepath fill
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 0 112 moveto
+0 216 lineto
+56 216 lineto
+56 112 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+12.5 199.4 moveto 31 (AAA) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 0 190 moveto
+56 190 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+9.5 173.4 moveto 37 (5':[1]) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 0 164 moveto
+56 164 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+8 147.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 0 138 moveto
+56 138 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+16.5 121.4 moveto 23 (1.0) alignedtext
+grestore
+% AAT
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 140 112 moveto
+140 216 lineto
+196 216 lineto
+196 112 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+153.5 199.4 moveto 29 (AAT) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 140 190 moveto
+196 190 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+154 173.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 140 164 moveto
+196 164 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+148 147.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 140 138 moveto
+196 138 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+156.5 121.4 moveto 23 (1.0) alignedtext
+grestore
+% AAA->AAT
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 56.33 164 moveto
+77.39 164 106.37 164 129.53 164 curveto
+stroke
+0 0 0 edgecolor
+newpath 129.71 167.5 moveto
+139.71 164 lineto
+129.71 160.5 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 129.71 167.5 moveto
+139.71 164 lineto
+129.71 160.5 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+75.5 169.4 moveto 45 (FF: [1]) alignedtext
+grestore
+% AAT->AAA
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 139.51 147.99 moveto
+133.87 145.51 127.87 143.33 122 142 curveto
+101.2 137.28 94.8 137.28 74 142 curveto
+71.34 142.6 68.65 143.38 65.99 144.28 curveto
+stroke
+0 1 1 edgecolor
+newpath 64.53 141.09 moveto
+56.49 147.99 lineto
+67.08 147.61 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 64.53 141.09 moveto
+56.49 147.99 lineto
+67.08 147.61 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+74 147.4 moveto 48 (RR: [1]) alignedtext
+grestore
+% ATA
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 280 112 moveto
+280 216 lineto
+336 216 lineto
+336 112 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+294 199.4 moveto 28 (ATA) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 280 190 moveto
+336 190 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+294 173.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 280 164 moveto
+336 164 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+288 147.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 280 138 moveto
+336 138 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+296.5 121.4 moveto 23 (2.0) alignedtext
+grestore
+% AAT->ATA
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 196.33 164 moveto
+217.39 164 246.37 164 269.53 164 curveto
+stroke
+0 0 0 edgecolor
+newpath 269.71 167.5 moveto
+279.71 164 lineto
+269.71 160.5 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 269.71 167.5 moveto
+279.71 164 lineto
+269.71 160.5 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+215.5 169.4 moveto 45 (FF: [1]) alignedtext
+grestore
+% GAA
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 738 61 moveto
+738 165 lineto
+794 165 lineto
+794 61 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+750 148.4 moveto 32 (GAA) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 738 139 moveto
+794 139 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+752 122.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 738 113 moveto
+794 113 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+746 96.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 738 87 moveto
+794 87 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+754.5 70.4 moveto 23 (2.0) alignedtext
+grestore
+% AAG
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 122 moveto
+878 226 lineto
+934 226 lineto
+934 122 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+890 209.4 moveto 32 (AAG) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 200 moveto
+934 200 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+892 183.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 174 moveto
+934 174 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+886 157.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 148 moveto
+934 148 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+894.5 131.4 moveto 23 (1.0) alignedtext
+grestore
+% GAA->AAG
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 794.1 141.19 moveto
+799.69 145.67 805.77 149.85 812 153 curveto
+829.22 161.7 850.01 166.82 867.65 169.83 curveto
+stroke
+0 0 0 edgecolor
+newpath 867.21 173.3 moveto
+877.62 171.36 lineto
+868.27 166.38 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 867.21 173.3 moveto
+877.62 171.36 lineto
+868.27 166.38 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+813.5 173.4 moveto 45 (FF: [2]) alignedtext
+grestore
+% AAC
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 0 moveto
+878 104 lineto
+934 104 lineto
+934 0 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+890.5 87.4 moveto 31 (AAC) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 78 moveto
+934 78 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+892 61.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 52 moveto
+934 52 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+886 35.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 878 26 moveto
+934 26 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+894.5 9.4 moveto 23 (1.0) alignedtext
+grestore
+% GAA->AAC
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 794.33 100.66 moveto
+815.68 91.35 845.16 78.51 868.47 68.35 curveto
+stroke
+0 0 0 edgecolor
+newpath 869.94 71.53 moveto
+877.71 64.33 lineto
+867.15 65.11 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 869.94 71.53 moveto
+877.71 64.33 lineto
+867.15 65.11 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+813.5 97.4 moveto 45 (FF: [1]) alignedtext
+grestore
+% AGA
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 584 61 moveto
+584 165 lineto
+640 165 lineto
+640 61 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+596.5 148.4 moveto 31 (AGA) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 584 139 moveto
+640 139 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+598 122.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 584 113 moveto
+640 113 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+592 96.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 584 87 moveto
+640 87 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+600.5 70.4 moveto 23 (2.0) alignedtext
+grestore
+% GAA->AGA
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 737.83 99.35 moveto
+732.06 97.13 725.93 95.18 720 94 curveto
+692.97 88.64 685.03 88.64 658 94 curveto
+655.31 94.53 652.58 95.23 649.87 96.03 curveto
+stroke
+0 1 1 edgecolor
+newpath 648.5 92.8 moveto
+640.17 99.35 lineto
+650.76 99.42 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 648.5 92.8 moveto
+640.17 99.35 lineto
+650.76 99.42 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+658.5 99.4 moveto 61 (RR: [1,2]) alignedtext
+grestore
+% AAG->GAA
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 877.97 143.29 moveto
+872.42 138.58 866.33 134.22 860 131 curveto
+842.79 122.25 821.84 117.73 804.09 115.41 curveto
+stroke
+0 1 1 edgecolor
+newpath 804.38 111.92 moveto
+794.06 114.28 lineto
+803.6 118.88 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 804.38 111.92 moveto
+794.06 114.28 lineto
+803.6 118.88 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+812 136.4 moveto 48 (RR: [2]) alignedtext
+grestore
+% AGG
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 137 moveto
+1018 241 lineto
+1074 241 lineto
+1074 137 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1029.5 224.4 moveto 33 (AGG) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 215 moveto
+1074 215 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1032 198.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 189 moveto
+1074 189 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1026 172.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 163 moveto
+1074 163 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1034.5 146.4 moveto 23 (1.0) alignedtext
+grestore
+% AAG->AGG
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 934.33 177.04 moveto
+955.39 179.29 984.37 182.4 1007.53 184.88 curveto
+stroke
+0 0 0 edgecolor
+newpath 1007.4 188.38 moveto
+1017.71 185.97 lineto
+1008.14 181.42 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 1007.4 188.38 moveto
+1017.71 185.97 lineto
+1008.14 181.42 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+953.5 188.4 moveto 45 (FF: [2]) alignedtext
+grestore
+% AAC->GAA
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 877.77 45.66 moveto
+858.27 42.75 832.3 41.88 812 52 curveto
+808.36 53.81 804.94 56.06 801.73 58.62 curveto
+stroke
+0 1 1 edgecolor
+newpath 799.19 56.21 moveto
+794.19 65.55 lineto
+803.92 61.36 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 799.19 56.21 moveto
+794.19 65.55 lineto
+803.92 61.36 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+812 57.4 moveto 48 (RR: [1]) alignedtext
+grestore
+% ACC
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 10 moveto
+1018 114 lineto
+1074 114 lineto
+1074 10 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1031 97.4 moveto 30 (ACC) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 88 moveto
+1074 88 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1032 71.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 62 moveto
+1074 62 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1026 45.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 1018 36 moveto
+1074 36 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+1034.5 19.4 moveto 23 (1.0) alignedtext
+grestore
+% AAC->ACC
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 934.17 65.65 moveto
+939.94 67.87 946.07 69.82 952 71 curveto
+970.11 74.59 990.48 73.28 1007.61 70.69 curveto
+stroke
+0 0 0 edgecolor
+newpath 1008.55 74.08 moveto
+1017.82 68.94 lineto
+1007.37 67.18 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 1008.55 74.08 moveto
+1017.82 68.94 lineto
+1007.37 67.18 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+953.5 79.4 moveto 45 (FF: [1]) alignedtext
+grestore
+% AGA->GAA
+gsave
+1 setlinewidth
+0 0 0 edgecolor
+newpath 640.25 113 moveto
+664.78 113 700.52 113 727.64 113 curveto
+stroke
+0 0 0 edgecolor
+newpath 727.93 116.5 moveto
+737.93 113 lineto
+727.93 109.5 lineto
+closepath fill
+1 setlinewidth
+solid
+0 0 0 edgecolor
+newpath 727.93 116.5 moveto
+737.93 113 lineto
+727.93 109.5 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+660 118.4 moveto 58 (FF: [1,2]) alignedtext
+grestore
+% CTA
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 51 moveto
+432 155 lineto
+488 155 lineto
+488 51 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+446 138.4 moveto 28 (CTA) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 129 moveto
+488 129 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+446 112.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 103 moveto
+488 103 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+440 86.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 77 moveto
+488 77 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+448.5 60.4 moveto 23 (2.0) alignedtext
+grestore
+% AGA->CTA
+gsave
+1 setlinewidth
+0.33333 1 1 edgecolor
+newpath 583.9 106.65 moveto
+578.02 105.56 571.83 104.59 566 104 curveto
+543.7 101.73 518.64 101.4 498.48 101.67 curveto
+stroke
+0.33333 1 1 edgecolor
+newpath 498.35 98.17 moveto
+488.42 101.86 lineto
+498.49 105.17 lineto
+closepath fill
+1 setlinewidth
+solid
+0.33333 1 1 edgecolor
+newpath 498.35 98.17 moveto
+488.42 101.86 lineto
+498.49 105.17 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+506 109.4 moveto 60 (RF: [1,2]) alignedtext
+grestore
+% CCA
+gsave
+0 0 0.75294 nodecolor
+newpath 584 188 moveto
+584 292 lineto
+640 292 lineto
+640 188 lineto
+closepath fill
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 584 188 moveto
+584 292 lineto
+640 292 lineto
+640 188 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+597 275.4 moveto 30 (CCA) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 584 266 moveto
+640 266 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+593.5 249.4 moveto 37 (5':[2]) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 584 240 moveto
+640 240 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+592 223.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+filled
+0 0 0 nodecolor
+newpath 584 214 moveto
+640 214 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+600.5 197.4 moveto 23 (1.0) alignedtext
+grestore
+% ATG
+gsave
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 173 moveto
+432 277 lineto
+488 277 lineto
+488 173 lineto
+closepath stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+445 260.4 moveto 30 (ATG) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 251 moveto
+488 251 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+446 234.4 moveto 28 (5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 225 moveto
+488 225 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+440 208.4 moveto 40 (~5':[]) alignedtext
+1 setlinewidth
+0 0 0 nodecolor
+newpath 432 199 moveto
+488 199 lineto
+stroke
+0 0 0 nodecolor
+14 /Times-Roman set_font
+448.5 182.4 moveto 23 (1.0) alignedtext
+grestore
+% CCA->ATG
+gsave
+1 setlinewidth
+0.66667 1 1 edgecolor
+newpath 583.88 215 moveto
+578.3 211.3 572.23 208.05 566 206 curveto
+540.67 197.66 532.16 200.81 506 206 curveto
+503.31 206.53 500.58 207.23 497.87 208.03 curveto
+stroke
+0.66667 1 1 edgecolor
+newpath 496.5 204.8 moveto
+488.17 211.35 lineto
+498.76 211.42 lineto
+closepath fill
+1 setlinewidth
+solid
+0.66667 1 1 edgecolor
+newpath 496.5 204.8 moveto
+488.17 211.35 lineto
+498.76 211.42 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+513 211.4 moveto 46 (FR: [2]) alignedtext
+grestore
+% ATG->CCA
+gsave
+1 setlinewidth
+0.66667 1 1 edgecolor
+newpath 488.23 227.79 moveto
+512.34 230.16 547.22 233.61 573.81 236.23 curveto
+stroke
+0.66667 1 1 edgecolor
+newpath 573.62 239.73 moveto
+583.92 237.23 lineto
+574.31 232.76 lineto
+closepath fill
+1 setlinewidth
+solid
+0.66667 1 1 edgecolor
+newpath 573.62 239.73 moveto
+583.92 237.23 lineto
+574.31 232.76 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+513 240.4 moveto 46 (FR: [2]) alignedtext
+grestore
+% ATG->ATA
+gsave
+1 setlinewidth
+0.33333 1 1 edgecolor
+newpath 431.77 193.96 moveto
+426.28 189.35 420.27 185.11 414 182 curveto
+393.11 171.65 367.37 167.12 346.49 165.18 curveto
+stroke
+0.33333 1 1 edgecolor
+newpath 346.6 161.68 moveto
+336.37 164.41 lineto
+346.07 168.66 lineto
+closepath fill
+1 setlinewidth
+solid
+0.33333 1 1 edgecolor
+newpath 346.6 161.68 moveto
+336.37 164.41 lineto
+346.07 168.66 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+361 187.4 moveto 46 (RF: [2]) alignedtext
+grestore
+% CTA->AGA
+gsave
+1 setlinewidth
+0.33333 1 1 edgecolor
+newpath 488.17 116.65 moveto
+493.94 118.87 500.07 120.82 506 122 curveto
+528.21 126.41 553.47 124.53 573.75 121.37 curveto
+stroke
+0.33333 1 1 edgecolor
+newpath 574.6 124.78 moveto
+583.87 119.63 lineto
+573.42 117.88 lineto
+closepath fill
+1 setlinewidth
+solid
+0.33333 1 1 edgecolor
+newpath 574.6 124.78 moveto
+583.87 119.63 lineto
+573.42 117.88 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+506 130.4 moveto 60 (RF: [1,2]) alignedtext
+grestore
+% CTA->ATA
+gsave
+1 setlinewidth
+0.66667 1 1 edgecolor
+newpath 431.81 95.12 moveto
+409.46 90.47 378.08 87.65 354 100 curveto
+350.23 101.93 346.7 104.33 343.41 107.06 curveto
+stroke
+0.66667 1 1 edgecolor
+newpath 341 104.52 moveto
+336.16 113.94 lineto
+345.82 109.6 lineto
+closepath fill
+1 setlinewidth
+solid
+0.66667 1 1 edgecolor
+newpath 341 104.52 moveto
+336.16 113.94 lineto
+345.82 109.6 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+354 105.4 moveto 60 (FR: [1,2]) alignedtext
+grestore
+% ATA->AAT
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 279.83 150.35 moveto
+274.06 148.13 267.93 146.18 262 145 curveto
+241.07 140.85 234.93 140.85 214 145 curveto
+211.31 145.53 208.58 146.23 205.87 147.03 curveto
+stroke
+0 1 1 edgecolor
+newpath 204.5 143.8 moveto
+196.17 150.35 lineto
+206.76 150.42 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 204.5 143.8 moveto
+196.17 150.35 lineto
+206.76 150.42 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+214 150.4 moveto 48 (RR: [1]) alignedtext
+grestore
+% ATA->ATG
+gsave
+1 setlinewidth
+0.33333 1 1 edgecolor
+newpath 336.04 192.32 moveto
+341.63 196.78 347.73 200.93 354 204 curveto
+375.04 214.31 400.78 219.56 421.63 222.23 curveto
+stroke
+0.33333 1 1 edgecolor
+newpath 421.4 225.73 moveto
+431.73 223.38 lineto
+422.19 218.77 lineto
+closepath fill
+1 setlinewidth
+solid
+0.33333 1 1 edgecolor
+newpath 421.4 225.73 moveto
+431.73 223.38 lineto
+422.19 218.77 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+361 225.4 moveto 46 (RF: [2]) alignedtext
+grestore
+% ATA->CTA
+gsave
+1 setlinewidth
+0.66667 1 1 edgecolor
+newpath 336.17 152.23 moveto
+342.05 149.81 348.22 147.3 354 145 curveto
+380.53 134.44 387.47 132.56 414 122 curveto
+416.71 120.92 419.5 119.8 422.31 118.66 curveto
+stroke
+0.66667 1 1 edgecolor
+newpath 423.89 121.79 moveto
+431.83 114.77 lineto
+421.25 115.31 lineto
+closepath fill
+1 setlinewidth
+solid
+0.66667 1 1 edgecolor
+newpath 423.89 121.79 moveto
+431.83 114.77 lineto
+421.25 115.31 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+354 150.4 moveto 60 (FR: [1,2]) alignedtext
+grestore
+% ACC->AAC
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 1017.55 52.65 moveto
+1011.8 51.13 1005.75 49.8 1000 49 curveto
+981.78 46.48 961.4 46.75 944.29 47.86 curveto
+stroke
+0 1 1 edgecolor
+newpath 943.81 44.38 moveto
+934.1 48.63 lineto
+944.34 51.36 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 943.81 44.38 moveto
+934.1 48.63 lineto
+944.34 51.36 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+952 54.4 moveto 48 (RR: [1]) alignedtext
+grestore
+% AGG->AAG
+gsave
+1 setlinewidth
+0 1 1 edgecolor
+newpath 1017.97 165.62 moveto
+1012.33 162.07 1006.22 158.95 1000 157 curveto
+982.01 151.36 961.46 154.08 944.17 158.85 curveto
+stroke
+0 1 1 edgecolor
+newpath 942.94 155.56 moveto
+934.41 161.85 lineto
+945 162.26 lineto
+closepath fill
+1 setlinewidth
+solid
+0 1 1 edgecolor
+newpath 942.94 155.56 moveto
+934.41 161.85 lineto
+945 162.26 lineto
+closepath stroke
+0 0 0 edgecolor
+14 /Times-Roman set_font
+952 162.4 moveto 48 (RR: [2]) alignedtext
+grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+%%BoundingBox: 36 36 1118 336
+end
+restore
+%%EOF
diff --git a/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/test.txt b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/test.txt
new file mode 100644
index 0000000..36a4bdd
--- /dev/null
+++ b/genomix/genomix-pregelix/data/TestSet/PathMerge/head_7/test.txt
@@ -0,0 +1,12 @@
+AAA	{[{AAT:[1]}]	[]	[]	[]	{5':[(1-0_0)], ~5':[]}	1.0x}
+GAA	{[{AAG:[2]}, {AAC:[1]}]	[]	[]	[{AGA:[1,2]}]	{5':[], ~5':[]}	2.0x}
+CCA	{[]	[{ATG:[2]}]	[]	[]	{5':[(2-0_0)], ~5':[]}	1.0x}
+AGA	{[{GAA:[1,2]}]	[]	[{CTA:[1,2]}]	[]	{5':[], ~5':[]}	2.0x}
+ATA	{[]	[{CTA:[1,2]}]	[{ATG:[2]}]	[{AAT:[1]}]	{5':[], ~5':[]}	2.0x}
+CTA	{[]	[{ATA:[1,2]}]	[{AGA:[1,2]}]	[]	{5':[], ~5':[]}	2.0x}
+AAC	{[{ACC:[1]}]	[]	[]	[{GAA:[1]}]	{5':[], ~5':[]}	1.0x}
+ACC	{[]	[]	[]	[{AAC:[1]}]	{5':[], ~5':[]}	1.0x}
+AAG	{[{AGG:[2]}]	[]	[]	[{GAA:[2]}]	{5':[], ~5':[]}	1.0x}
+AGG	{[]	[]	[]	[{AAG:[2]}]	{5':[], ~5':[]}	1.0x}
+ATG	{[]	[{CCA:[2]}]	[{ATA:[2]}]	[]	{5':[], ~5':[]}	1.0x}
+AAT	{[{ATA:[1]}]	[]	[]	[{AAA:[1]}]	{5':[], ~5':[]}	1.0x}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
index d9929cd..f086698 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
@@ -37,12 +37,11 @@
     
     public static class VertexStateFlag extends FakeFlag {
         public static final byte IS_NON = 0b00 << 5;
-        public static final byte IS_RANDOMTAIL = 0b00 << 5;
         public static final byte IS_HEAD = 0b01 << 5;
-        public static final byte IS_FINAL = 0b10 << 5;
-        public static final byte IS_RANDOMHEAD = 0b11 << 5;
+        public static final byte IS_FINAL = 0b10 << 5; 
         public static final byte IS_OLDHEAD = 0b11 << 5;
-
+        
+        public static final byte IS_HALT = 0b1111111;
         public static final byte VERTEX_MASK = 0b11 << 5;
         public static final byte VERTEX_CLEAR = (byte) 11001111;
     }
@@ -208,13 +207,18 @@
     /**
      * Process any changes to value.  This is for edge updates.  nodeToAdd should be only edge
      */
-    public void processUpdates(byte neighborToDeleteDir, VKmerBytesWritable nodeToDelete,
-            byte neighborToMergeDir, EdgeWritable nodeToAdd){
-        byte deleteDir = (byte)(neighborToDeleteDir & MessageFlag.DIR_MASK);
-        this.getEdgeList(deleteDir).remove(nodeToDelete);
-        
-        byte mergeDir = (byte)(neighborToMergeDir & MessageFlag.DIR_MASK);
-        this.getEdgeList(mergeDir).add(nodeToAdd);
+//    public void processUpdates(byte neighborToDeleteDir, VKmerBytesWritable nodeToDelete,
+//            byte neighborToMergeDir, NodeWritable node){
+//        byte deleteDir = (byte)(neighborToDeleteDir & MessageFlag.DIR_MASK);
+//        this.getEdgeList(deleteDir).remove(nodeToDelete);
+//        
+//        byte mergeDir = (byte)(neighborToMergeDir & MessageFlag.DIR_MASK);
+////        this.getEdgeList(mergeDir).add(nodeToAdd);
+//        
+//        this.getNode().mergeEdges(mergeDir, node);
+//    }
+    public void processUpdates(byte neighborToDeleteDir, NodeWritable node){
+        this.getNode().mergeEdges(neighborToDeleteDir, node);
     }
     
     /**
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/BasicGraphCleanVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/BasicGraphCleanVertex.java
index ff45b45..5db3636 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/BasicGraphCleanVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/BasicGraphCleanVertex.java
@@ -103,6 +103,10 @@
         getVertexValue().setState(state);
     }
     
+    public boolean isHaltNode(){
+        return getVertexValue().getState() == State.IS_HALT;
+    }
+    
     /**
      * check the message type
      */
@@ -358,35 +362,41 @@
     public void initState(Iterator<M> msgIterator) {
         while (msgIterator.hasNext()) {
             incomingMsg = msgIterator.next();
-            byte headMergeDir = (byte) (incomingMsg.getFlag() & MessageFlag.HEAD_SHOULD_MERGE_MASK);
-            switch(headMergeDir){
-                case MessageFlag.HEAD_SHOULD_MERGEWITHPREV:
-                    if(VertexUtil.isValidRear(getVertexValue())){
-                        /** not set up yet **/
-                        if(getHeadFlag() != MessageFlag.IS_HEAD){
-                            getVertexValue().setState(incomingMsg.getFlag());
-                        } else{ /** already set up **/
-                            /** if headMergeDir are not the same **/
-                            if(getHeadMergeDir() != headMergeDir){
-                                getVertexValue().setState(MessageFlag.IS_NON);
-                            }
-                        }
-                    }
-                    break;
-                case MessageFlag.HEAD_SHOULD_MERGEWITHNEXT:
-                    if(VertexUtil.isValidHead(getVertexValue())){
-                        /** not set up yet **/
-                        if(getHeadFlag() != MessageFlag.IS_HEAD){
-                            getVertexValue().setState(incomingMsg.getFlag());
-                        } else{ /** already set up **/
-                            /** if headMergeDir are not the same **/
-                            if(getHeadMergeDir() != headMergeDir){
-                                getVertexValue().setState(MessageFlag.IS_NON);
-                            }
-                        }
-                    }
-                    break;
+            if(getHeadFlag() != MessageFlag.IS_HEAD){
+                getVertexValue().setState(incomingMsg.getFlag());
+            } else{ /** already set up **/
+                /** if headMergeDir are not the same **/
+                getVertexValue().setState(MessageFlag.IS_HALT);
+                voteToHalt();
             }
+        }
+//            byte headMergeDir = (byte) (incomingMsg.getFlag() & MessageFlag.HEAD_SHOULD_MERGE_MASK);
+//            switch(headMergeDir){
+//                case MessageFlag.HEAD_SHOULD_MERGEWITHPREV:
+//                    /** not set up yet **/
+//                    if(getHeadFlag() != MessageFlag.IS_HEAD){
+//                        getVertexValue().setState(incomingMsg.getFlag());
+//                    } else{ /** already set up **/
+//                        /** if headMergeDir are not the same **/
+//                        if(getHeadMergeDir() != headMergeDir){
+//                            getVertexValue().setState(MessageFlag.IS_HALT);
+//                            voteToHalt();
+//                        }
+//                    }
+//                    break;
+//                case MessageFlag.HEAD_SHOULD_MERGEWITHNEXT:
+//                    /** not set up yet **/
+//                    if(getHeadFlag() != MessageFlag.IS_HEAD){
+//                        getVertexValue().setState(incomingMsg.getFlag());
+//                    } else{ /** already set up **/
+//                        /** if headMergeDir are not the same **/
+//                        if(getHeadMergeDir() != headMergeDir){
+//                            getVertexValue().setState(MessageFlag.IS_HALT);
+//                            voteToHalt();
+//                        }
+//                    }
+//                    break;
+//            }
 //            if (!VertexUtil.isPathVertex(getVertexValue())
 //                    && !VertexUtil.isHeadWithoutIndegree(getVertexValue())
 //                    && !VertexUtil.isRearWithoutOutdegree(getVertexValue())) {
@@ -399,7 +409,6 @@
 //                else 
 //                    getVertexValue().setState(incomingMsg.getFlag());
 //            }
-        }
     }
     
     /**
@@ -412,6 +421,13 @@
             return false;
     }
     
+    public boolean ifFlipWithPredecessor(VKmerBytesWritable toFind){
+        if(getVertexValue().getRFList().contains(toFind))
+            return true;
+        else
+            return false;
+    }
+    
     /**
      * check if A need to be flipped with successor
      */
@@ -422,6 +438,13 @@
             return false;
     }
     
+    public boolean ifFilpWithSuccessor(VKmerBytesWritable toFind){
+        if(getVertexValue().getFRList().contains(toFind))
+            return true;
+        else
+            return false;
+    }
+    
     /**
      * set adjMessage to predecessor(from successor)
      */
@@ -433,6 +456,14 @@
             outFlag |= MessageFlag.DIR_RR;
     }
     
+    public void setPredecessorAdjMsg(VKmerBytesWritable toFind){
+        outFlag &= MessageFlag.DIR_CLEAR;
+        if(getVertexValue().getRFList().contains(toFind))
+            outFlag |= MessageFlag.DIR_RF;
+        else if(getVertexValue().getRRList().contains(toFind))
+            outFlag |= MessageFlag.DIR_RR;
+    }
+    
     /**
      * set adjMessage to successor(from predecessor)
      */
@@ -444,6 +475,14 @@
             outFlag |= MessageFlag.DIR_FR;
     }
     
+    public void setSuccessorAdjMsg(VKmerBytesWritable toFind){
+        outFlag &= MessageFlag.DIR_CLEAR;
+        if(getVertexValue().getFFList().contains(toFind))
+            outFlag |= MessageFlag.DIR_FF;
+        else if(getVertexValue().getFRList().contains(toFind))
+            outFlag |= MessageFlag.DIR_FR;
+    }
+    
     /**
      * set state as no_merge
      */
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
index 32ce597..87c4c76 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
@@ -36,10 +36,9 @@
         byte meToNeighborDir = (byte) (inFlag & MessageFlag.DIR_MASK);
         byte neighborToMeDir = mirrorDirection(meToNeighborDir);
         
-        byte neighborToMergeDir = flipDirection(neighborToMeDir, incomingMsg.isFlip());
-        
-        getVertexValue().processUpdates(neighborToMeDir, incomingMsg.getSourceVertexId(), 
-                neighborToMergeDir, incomingMsg.getNeighborEdge());
+//        getVertexValue().processUpdates(neighborToMeDir, incomingMsg.getSourceVertexId(), 
+//                neighborToMergeDir, incomingMsg.getNeighborEdge());
+        getVertexValue().processUpdates(neighborToMeDir, incomingMsg.getNode());
     }
     
     /**
@@ -97,11 +96,11 @@
     public void processFinalMerge(PathMergeMessageWritable msg){
         byte meToNeighborDir = (byte) (msg.getFlag() & MessageFlag.DIR_MASK); 
         byte neighborToMeDir = mirrorDirection(meToNeighborDir);
-        byte neighborToMergeDir = 0;
-        if(getMsgFlag() == MessageFlag.IS_FINAL)
-            neighborToMergeDir = neighborToMeDir;
-        else
-            neighborToMergeDir = flipDirection(neighborToMeDir, msg.isFlip());
+//        byte neighborToMergeDir = 0;
+//        if(getMsgFlag() == MessageFlag.IS_FINAL)
+//            neighborToMergeDir = neighborToMeDir;
+//        else
+//            neighborToMergeDir = flipDirection(neighborToMeDir, msg.isFlip());
         
         String selfString;
         String match;
@@ -148,27 +147,49 @@
      * configure UPDATE msg
      */
     public void configureUpdateMsgForPredecessor(){
-        if(getPrevDestVertexId() != null){
-            setPredecessorAdjMsg();
-            if(ifFilpWithSuccessor())
-                outgoingMsg.setFlip(true);
+        outgoingMsg.setSourceVertexId(getVertexId());
+        for(byte d: OutgoingListFlag.values)
+            outgoingMsg.setEdgeList(d, getVertexValue().getEdgeList(d));
+        
+        kmerIterator = getVertexValue().getRFList().getKeys();
+        while(kmerIterator.hasNext()){
+            destVertexId.setAsCopy(kmerIterator.next());
+            setPredecessorAdjMsg(destVertexId);
             outgoingMsg.setFlag(outFlag);
-            for(byte d: OutgoingListFlag.values)
-                outgoingMsg.setEdgeList(d, getVertexValue().getEdgeList(d));
-            outgoingMsg.setSourceVertexId(getVertexId());
-            sendMsg(getPrevDestVertexId(), outgoingMsg);
+            outgoingMsg.setFlip(ifFilpWithSuccessor(destVertexId));
+            sendMsg(destVertexId, outgoingMsg);
+        }
+        kmerIterator = getVertexValue().getRRList().getKeys();
+        while(kmerIterator.hasNext()){
+            destVertexId.setAsCopy(kmerIterator.next());
+            setPredecessorAdjMsg(destVertexId);
+            outgoingMsg.setFlag(outFlag);
+            outgoingMsg.setFlip(ifFilpWithSuccessor(destVertexId));
+            sendMsg(destVertexId, outgoingMsg);
         }
     }
     
     public void configureUpdateMsgForSuccessor(){
-        if(getNextDestVertexId() != null){
-            setSuccessorAdjMsg();
+        outgoingMsg.setSourceVertexId(getVertexId());
+        for(byte d: IncomingListFlag.values)
+            outgoingMsg.setEdgeList(d, getVertexValue().getEdgeList(d));
+        
+        kmerIterator = getVertexValue().getFFList().getKeys();
+        while(kmerIterator.hasNext()){
+            destVertexId.setAsCopy(kmerIterator.next());
+            setSuccessorAdjMsg(destVertexId);
             outgoingMsg.setFlag(outFlag);
-            outgoingMsg.setSourceVertexId(getVertexId());
-            outgoingMsg.setFlip(ifFlipWithPredecessor());  
-            for(byte d: IncomingListFlag.values)
-                outgoingMsg.setEdgeList(d, getVertexValue().getEdgeList(d));
-            sendMsg(getNextDestVertexId(), outgoingMsg);
+            outgoingMsg.setFlip(ifFlipWithPredecessor(destVertexId));  
+            sendMsg(destVertexId, outgoingMsg);
+        }
+        kmerIterator = getVertexValue().getFRList().getKeys();
+        while(kmerIterator.hasNext()){
+            destVertexId.setAsCopy(kmerIterator.next());
+            setSuccessorAdjMsg(destVertexId);
+            outgoingMsg.setFlag(outFlag);
+            outgoingMsg.setFlip(ifFlipWithPredecessor(destVertexId));  
+            destVertexId.setAsCopy(kmerIterator.next());
+            sendMsg(destVertexId, outgoingMsg);
         }
     }
 	/**
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
index f949092..2022976 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
@@ -12,7 +12,6 @@
 import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
 import edu.uci.ics.genomix.pregelix.io.VertexValueWritable.State;
 import edu.uci.ics.genomix.pregelix.type.MessageFlag;
-import edu.uci.ics.genomix.pregelix.util.VertexUtil;
 import edu.uci.ics.genomix.type.VKmerBytesWritable;
 
 /*
@@ -200,9 +199,10 @@
             while (msgIterator.hasNext()) {
                 incomingMsg = msgIterator.next();
                 processUpdate();
-                this.activate();
-                if(VertexUtil.isHeadOrRearVertexWithDegree(getVertexValue()))
+                if(isHaltNode())
                     voteToHalt();
+                else
+                    this.activate();
             }
         } else if (getSuperstep() % 4 == 1){
             //send message to the merge object and kill self
@@ -213,10 +213,11 @@
                 incomingMsg = msgIterator.next();
                 selfFlag = (byte) (State.VERTEX_MASK & getVertexValue().getState());
                 processMerge();
-                this.activate();
                 //head meets head, stop
                 if(getMsgFlag() == MessageFlag.IS_HEAD && selfFlag == MessageFlag.IS_HEAD)
                     voteToHalt();
+                else
+                    this.activate();
             }
         }
     }
diff --git a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/PathMergeTestSuite.java b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/PathMergeTestSuite.java
index 4fd8656..c64a5cf 100644
--- a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/PathMergeTestSuite.java
+++ b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/PathMergeTestSuite.java
@@ -6,15 +6,16 @@
 
     public static Test suite() throws Exception {
         String pattern ="PathMerge";
-        String testSet[] = {"2", "3", "4", "5", "6", "7", "8", "9"}; 
-//                {
+        String testSet[] = //{"2", "3", "4", "5", "6", "7", "8", "9"}; 
+                {
 //                "SimplePath",
 //                "ThreeDuplicate",
 //                "head_6"
+                "head_7"
 //                "CyclePath",
 //                "SelfPath"
 //                "TreePath"
-//                };
+                };
         init(pattern, testSet);
         BasicGraphCleanTestSuite testSuite = new BasicGraphCleanTestSuite();
         return makeTestSuite(testSuite);