@@ -0,0 +1,1712 @@
+import java.io.*;%0D%0Aimport java.util.*;%0D%0A%0D%0Apublic class depth_first_search%7B%0D%0A%0D%0A%0D%0A  static class Edge %7B%0D%0A    int src;%0D%0A    int nbr;%0D%0A    int wt;%0D%0A%0D%0A    Edge(int src, int nbr, int wt) %7B%0D%0A      this.src = src;%0D%0A      this.nbr = nbr;%0D%0A      this.wt = wt;%0D%0A    %7D%0D%0A  %7D%0D%0A%0D%0A    public static void main(String%5B%5D args) throws Exception %7B%0D%0A      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0D%0A    %0D%0A      int vtces = Integer.parseInt(br.readLine());%0D%0A      ArrayList%3CEdge%3E%5B%5D graph = new ArrayList%3C%3E%5Bvtces%5D;%0D%0A      for (int i = 0; i %3C vtces; i++) %7B%0D%0A        graph%5Bi%5D = new ArrayList%3C%3E();%0D%0A      %7D%0D%0A    %0D%0A      int edges = Integer.parseInt(br.readLine());%0D%0A      for (int i = 0; i %3C edges; i++) %7B%0D%0A        String%5B%5D parts = br.readLine().split(%22 %22);%0D%0A        int v1 = Integer.parseInt(parts%5B0%5D);%0D%0A        int v2 = Integer.parseInt(parts%5B1%5D);%0D%0A        int wt = Integer.parseInt(parts%5B2%5D);%0D%0A        graph%5Bv1%5D.add(new depth_first_search.Edge(v1, v2, wt));%0D%0A        graph%5Bv2%5D.add(new depth_first_search.Edge(v2, v1, wt));%0D%0A      %7D%0D%0A    %0D%0A      int src = Integer.parseInt(br.readLine());%0D%0A      int dest = Integer.parseInt(br.readLine());%0D%0A    %0D%0A      boolean%5B%5D visited = new boolean%5Bvtces%5D;%0D%0A      boolean flag = depth_first_search.hasPath(graph, src, dest, visited);%0D%0A      System.out.println(flag);%0D%0A    %7D%0D%0A%0D%0A  public static boolean hasPath(ArrayList%3C Edge%3E%5B%5D graph, int src, int dest, boolean%5B%5D visited) %7B%0D%0A    if (src == dest)%0D%0A      return true;%0D%0A%0D%0A    visited%5Bsrc%5D = true;%0D%0A    for (Edge e : graph%5Bsrc%5D) %7B%0D%0A      if (!visited%5Be.nbr%5D) %7B%0D%0A        boolean nbrHasPath = hasPath(graph, e.nbr, dest, visited);%0D%0A        if (nbrHasPath)%0D%0A          return true;%0D%0A      %7D%0D%0A    %7D%0D%0A    return false;%0D%0A  %7D%0D%0A%7D%0D%0A

Add java code of Depth First Search.