Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class MainClass{
  2.     public static void main(String []args){
  3.         //{parent,child}
  4.         String [][]path={{"a","b"},{"a","c"},{"b","d"},{"b","e"},{"c","g"},{"g","h"},{"g","h"}};
  5.         Search s=new Search(path);
  6.         System.out.println("Depth-First Seatch");
  7.         s.DFS("d");
  8.         System.out.println(s.getProcess());
  9.         System.out.println();
  10.         System.out.println("Breath-First Seatch");
  11.         s.BFS("d");
  12.         System.out.println(s.getProcess());
  13.     }
  14. }