Skip to content
Snippets Groups Projects
Commit cc9c3b31 authored by Lawrence Chung's avatar Lawrence Chung
Browse files

remove unneeded constructor

parent a8911afa
No related branches found
No related tags found
No related merge requests found
package search;
public class GraphBuild {
public class Graph {
private final int V; // Number of nodes
private int E; // Number of edges
......@@ -9,12 +9,13 @@ public class GraphBuild {
public static void main(String[] args) {
int[] testArray = {6,6,0,3,1,5,2,3,3,5,4,7,5,6};
GraphBuild gb = new GraphBuild(testArray);
Graph gb = new Graph(testArray);
System.out.println(gb.E());
System.out.println(gb.V());
}
public GraphBuild(int V){
public Graph(int V){
this.V = V;
this.E = 0;
adj = (Fish<Integer>[]) new Fish[V];
......@@ -22,19 +23,6 @@ public class GraphBuild {
adj[v] = new Fish<Integer>();
}
public GraphBuild(int[] x){
this(x[0]);
E = x[1];
int i = 2;
while(i < x.length){
int v = x[i];
int w = x[i++];
addEdge(v,w);
i++;
E--;
}
}
public int V(){
return V;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment