public Graph getShortestPath(int start, int end) {
            Vertex vStart = vertices.get(start);
            Vertex vEnd = vertices.get(end);
            Queue<Vertex> queue = new ArrayDeque<Vertex>();
            boolean[] visited = new boolean[vertices.size()];
            Vertex[] parent = new Vertex[vertices.size()];

            /*
             * Find the shortest path from start to end. Store the parent
             * vertices of each vertex in the parent data structures. Stop when
             * the end vertex is reached.
             */
            queue.offer(vStart);
            boolean isFinished = false;
            while (!queue.isEmpty() && !isFinished) {
                Vertex v1 = queue.poll();
                int n1 = v1.getId();
                visited[n1] = true;

                for (Edge edge : adjacencyList.get(n1)) {
                    Vertex v2 = edge.getOppositeVertex(v1);
                    int n2 = v2.getId();

                    if (!visited[n2]) {
                        queue.offer(v2);
                        if (parent[n2] == null) {
                            parent[n2] = v1;
                        }
                    }

                    // end vertex is reached. Hence, no need to continue with
                    // the search.
                    if (n2 == end) {
                        isFinished = true;
                        break;
                    }
                }
            }

            Graph graph = new Graph();
            if (parent[vEnd.getId()] != null) {
                // Create a graph containing the path
                // from end to start.
                Vertex v1 = vEnd;
                int id = 0;
                int n1 = id;
                graph.addVertex(n1, v1.getName());
                id++;
                while (parent[v1.getId()] != null) {
                    Vertex v2 = parent[v1.getId()];
                    int n2 = id;
                    graph.addVertex(n2, v2.getName());
                    id++;
                    graph.addEdge(n1, n2);

                    v1 = v2;
                    n1 = n2;
                }
            }

            return graph;
        }