public void Dijkstra(int startNode) {
        System.out.println("Dijkestra's shortest path to all nodes");
        Node[] S = new Node[size];  //All vertices for which we have computed the shortest distance
        Node[] p = new Node[size];    //array of predecessors of v in the path s to v
        PriorityQueue<Node> V_S = new PriorityQueue(); //Vertices waiting to be processed

        int S_tail = 0;
        Node start = graph[startNode];
        S[S_tail] = start;    //Initialize S with start vertex
        start.d = 0;
        S_tail++;

        /*Initialize V_S with the remaining vertices*/
        int currentNode = startNode;
        currentNode = (currentNode + 1) % size;
        while (currentNode != startNode) {

            Node v = graph[currentNode];

            /*for all v in V_S (line 2 - 6)*/
            int vIndex = (int) (v.getItem() - 65);   //find index in matrix
            p[vIndex] = S[0];
            if (S[0].connections[vIndex] != null) {   //if there is an edge (s,v)
                v.d = S[0].connections[vIndex].weight;
            }
            V_S.add(v);
            currentNode = (currentNode + 1) % size;
        }

        /*Dijkestra's main loop*/
        Node u = S[0];
        /*While V_S is not empty*/
        while (!V_S.isEmpty()) {

            u = V_S.remove();  //find smallest d and remove
            S[S_tail] = u;
            S_tail = (S_tail + 1) % size;

            /*For all v adjacent to u in V_S*/
            int uIndex = u.getIndex();
            int vIndex = uIndex;
            vIndex = (vIndex + 1) % size;
            while (vIndex != uIndex) {
                Edge u_v = u.connections[vIndex];
                if (u_v != null && vIndex != startNode) {
                    Node v = u_v.target;
                    if ((u.d + u_v.weight) < v.d) {
                        v.d = (u.d + u_v.weight);
                        p[vIndex] = u;
                    }
                }
                vIndex = (vIndex + 1) % size;
            }
        }
        for (int i = 0; i < size; i++) {
            System.out.println(graph[i].getItem() + " " + graph[i].d);
        }
    }