-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDfsMainTrain.java
More file actions
30 lines (25 loc) · 1.04 KB
/
DfsMainTrain.java
File metadata and controls
30 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DfsMainTrain {
public static void main(String[] args) {
State U= new State("U");
State V= new State("V");
State X= new State("X");
State Y= new State("Y");
State W= new State("W");
State Z= new State("Z");
U.addToNieboresList(V).addToNieboresList(X);
X.addToNieboresList(V);
V.addToNieboresList(Y);
Y.addToNieboresList(X);
W.addToNieboresList(Y).addToNieboresList(Z);
Builder buffergraph= new Graphbuilder();
buffergraph.addToGraph(U).addToGraph(V).addToGraph(X).addToGraph(Y).addToGraph(W).addToGraph(Z);
SearchableGraph graph=new SearchableGraph(buffergraph,U);//new graph to solve
graph.printGraphWithVretxes();;
Searcher Dfs=new Dfs(); // new solver (dfs algorithm)
Dfs.search(graph);// this function make graph to deep first search tree and give us start times end times and who is the father in the best routes
}
}