Index: BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
===================================================================
--- BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java (revision 41)
+++ BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java (revision 45)
@@ -17,11 +17,20 @@
     int limit;
     int th;
+    double cut;
         
     public class LinkAndPath{
         ClassLink classLink;
         List<ClassLink> path;
+        boolean converge;
         public LinkAndPath(ClassLink classLink, List<ClassLink> path){
            this.classLink = classLink;
            this.path = path;
+           this.converge = false;
+        }
+        
+        public LinkAndPath(ClassLink classLink, List<ClassLink> path, boolean converge){
+           this.classLink = classLink;
+           this.path = path;
+           this.converge = converge;
         }
     }
@@ -36,4 +45,5 @@
         limit = 1000;
         th = 0;
+        cut = 2.0;
     }
     
@@ -73,15 +83,5 @@
         return patharray;
     }
-    
-    /*
-    private List<List<ClassLink>> searchPathsFromOWL(OWLQueryBuilderImpl qb){
-        return searchPathsEngine(qb, 0);
-    }
-    
-    private List<List<ClassLink>> searchPathsFromInstances(OWLQueryBuilderImpl qb){
-        return searchPathsEngine(qb, 1);
-    }
-    */
-    
+        
     private List<List<ClassLink>> searchPaths(OWLQueryBuilderImpl qb, int mode, boolean countLinks){
         List<List<ClassLink>> paths = new ArrayList<>();
@@ -122,3 +122,43 @@
         return paths;  
     }
+    
+    private List<List<ClassLink>> searchPathsWithCut(OWLQueryBuilderImpl qb){
+        List<List<ClassLink>> paths = new ArrayList<>();
+        ClassLink crrLink = new ClassLink(null,startClass,Direction.both,0);
+        List<LinkAndPath> lp = new LinkedList<>();
+        lp.add(new LinkAndPath(crrLink, new LinkedList<ClassLink>()));
+        try{
+          for ( int i = 0; i < nsteps; i++ ){
+              ListIterator<LinkAndPath> lit = lp.listIterator();
+              List<LinkAndPath> nextlp = new LinkedList<>();
+              while ( lit.hasNext() ){
+                  LinkAndPath crrlp = lit.next();
+                  ClassLink[] classLinks = null;
+                  classLinks = qb.getNextClassViaInstanceLink(null, crrlp.classLink.getLinkedClassURI(), limit); 
+                  for ( int j = 0 ; j < classLinks.length; j++ ){
+                      List<ClassLink> crrpath = new LinkedList<>(crrlp.path);
+                      crrpath.add(classLinks[j]);
+                      if ( classLinks[j].getLinkedClassURI().equals(endClass) ){
+                          paths.add(new LinkedList<>(crrpath));
+                          continue;
+                      }
+                      boolean con = false;
+                      double cont = 1.0;
+                      if ( cont > th ){ // shrink
+                          con = true;
+                      }
+                      if ( crrlp.converge == true && con == false ){ // converge & 縲diverge
+                          continue; // cut
+                      }
+                      nextlp.add(new LinkAndPath(classLinks[j], crrpath, con));
+                  }
+              }
+              lp = nextlp;
+          }
+        }catch(Exception e){ 
+            System.err.println(e);
+        }
+        return paths;  
+    }
+
 }
