diff --git a/src/main/java/Algorithm/Graph.java b/src/main/java/Algorithm/Graph.java index 2a803e81e7e51341fce783bfd6ee4934b1da645a..bbd6b9d99d04f02e91cce6dfc647b95a5b869f7c 100644 --- a/src/main/java/Algorithm/Graph.java +++ b/src/main/java/Algorithm/Graph.java @@ -45,7 +45,7 @@ public class Graph { } public int addVertex (String vertex) { - if (vertexIndex.containsKey(vertex) == false) { + if (!vertexIndex.containsKey(vertex)) { this.vertices.add(numberOfVertices) ; this.vertexIndex.put(vertex, numberOfVertices++) ; this.AdjList.add(new HashSet<>()) ; @@ -54,7 +54,10 @@ public class Graph { } public Graph(String args) { - AdjList = new ArrayList<>(); + this.AdjList = new ArrayList<>(); + this.vertexIndex = new HashMap<>() ; + this.numberOfVertices = 0 ; + this.vertices = new ArrayList<>() ; trianglecount = new HashMap<>(); try { BufferedReader br = new BufferedReader(new FileReader(args));