sortEdgesByWeight method
Sorts the neighbouring vertices of each vertex using weightComparator
.
- By default the neighbouring vertices of a vertex are listed in insertion order.
- Note: In general, adding further graph edges invalidates the sorting of neighbouring vertices.
Implementation
void sortEdgesByWeight([Comparator<W>? weightComparator]) {
for (final vertex in vertices) {
_edges[vertex]!.sortByValue(weightComparator);
}
}