Fixed bug in K-means graph representation caused due to global variable