From ba8eae3b1e9ff21ae32e97fa3b5f54b8983432c1 Mon Sep 17 00:00:00 2001
From: beginner1010 <vahid.sanei@gmail.com>
Date: Tue, 5 Jun 2018 13:55:05 -0500
Subject: [PATCH] Graph is updated. Null pointer exception is fixed

---
 src/main/java/Algorithm/Graph.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/Algorithm/Graph.java b/src/main/java/Algorithm/Graph.java
index 2a803e8..bbd6b9d 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));
-- 
GitLab