public void search(Vertex[] nodes, int start) {
   LinkedList<Vertex> queue = new LinkedList<>();
   nodes[start].numPaths = 1;
   nodes[start].minDistance = 0;
   queue.addLast(nodes[start]);
   while (!queue.isEmpty()) {
     Vertex curr = queue.removeFirst();
     for (Edge e : curr.edges) {
       Vertex other = e.end;
       if (!other.checked) {
         other.checked = true;
         queue.addLast(other);
       }
       if (curr.minDistance + e.weight < other.minDistance) {
         other.minDistance = curr.minDistance + e.weight;
         other.numPaths = curr.numPaths;
       } else if (curr.minDistance + e.weight == other.minDistance) {
         other.numPaths += curr.numPaths;
       }
     }
   }
 }