public mst(Graph G) {
		graphSize = G.getSize();
		mst1      = new Graph(graphSize);	//size of graph initialized to number of Vertices
		parent  = new int[graphSize];		//stores the parent values corresponding to every vertice. Used to decide whic								edges lie in the graph
		key     = new int[graphSize];		//stores the value of the weight a particular vertex belongs to
		
		
		/* keys are initially set to +infinity which is 1001 > max(cost) and parents are set to -2*/
		for(int index = 0; index < graphSize; index++) {
			parent[index] = -2;
			key[index]    = 1001;

		}
		/*The priority queue is initialized and the root element is deleted from linked list
		 *Parent of root set to -1 because this will help in checking the condition when the root is removed from linkedList
		 So that we dont end up adding another edge
		 * */
		parent[root] = -1;
		LinkedList<Integer>[] Q = initializeWeightArray(G);	
		key[root] = 0;
		deleteFromLinkedList(Q[weightSize - 1], linkedListPointer[root], root);
		keyMinSimple = 0;
		/*stores the position of a vertice in the linked list . Initially all are pushed to the array element max(cost) + 1 in                initializeWeightArray*/
		linkedListPointer[root] = pushIntoLinkedList(Q[keyMinSimple], root);
		/*keyMinSimple is the loop condition. if all keys are greater than max(cost) means that there are no edges left with                  lesser costs*/
		/* In this whileLoop iteratively extractMin is done and the edge with least cost from the minimum spanning tree 
		 * is added. At the end of this loop all n-1 edges of the mst are added to the result and returned
		 * */
		while(keyMinSimple <= wMaximumSimple) {
			Integer u = extractMin(Q);
			if(u != -1){
				LinkedList<Integer> adjacencyList = G.getAdjacencyList(u);
					
				for(Integer i = 0; i < adjacencyList.size(); i++) {
					Integer adjacentVertex = adjacencyList.get(i);
					int edgeWeight = G.getCost(u, adjacentVertex);
					if(linkedListPointer[adjacentVertex] != -1 && edgeWeight < key[adjacentVertex]) {
						parent[adjacentVertex] = u;
						deleteFromLinkedList(Q[key[adjacentVertex]], linkedListPointer[adjacentVertex] , 
							adjacentVertex);
						key[adjacentVertex] = edgeWeight;
						linkedListPointer[adjacentVertex] = pushIntoLinkedList(Q[key[adjacentVertex]], adjacentVertex);
					}
				}
				if(parent[u] != -1) {
					mst1.addEdge(parent[u], u, G.getCost(u, parent[u]));
				}

			}
		}
			

		
			
		
	}