MCPcopy Index your code
hub / github.com/careercup/ctci / createNewGraph

Method createNewGraph

java/Chapter 4/Question4_2/Question.java:19–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17 }
18
19 public static Graph createNewGraph()
20 {
21 Graph g = new Graph();
22 Node[] temp = new Node[6];
23
24 temp[0] = new Node("a", 3);
25 temp[1] = new Node("b", 0);
26 temp[2] = new Node("c", 0);
27 temp[3] = new Node("d", 1);
28 temp[4] = new Node("e", 1);
29 temp[5] = new Node("f", 0);
30
31 temp[0].addAdjacent(temp[1]);
32 temp[0].addAdjacent(temp[2]);
33 temp[0].addAdjacent(temp[3]);
34 temp[3].addAdjacent(temp[4]);
35 temp[4].addAdjacent(temp[5]);
36 for (int i = 0; i < 6; i++) {
37 g.addNode(temp[i]);
38 }
39 return g;
40 }
41
42 public static boolean search(Graph g,Node start,Node end) {
43 LinkedList<Node> q = new LinkedList<Node>();

Callers 1

mainMethod · 0.95

Calls 2

addNodeMethod · 0.95
addAdjacentMethod · 0.80

Tested by

no test coverage detected