sortEdges method
Sorts the neighbouring vertices of each vertex using comparator.
- By default the neighbouring vertices of a vertex are listed in insertion order.
- In general, adding further graph edges invalidates the sorting of neighbouring vertices.
- The optional parameter
vertexComparator
defaults to comparator.
Implementation
void sortEdges([Comparator<T>? vertexComparator]) {
if (comparator == null && vertexComparator == null) return;
for (final vertex in vertices) {
_edges[vertex]!.sortByKey(vertexComparator ?? comparator);
}
}