sortEdges method
void
sortEdges()
Sorts the neighbouring vertices of each vertex using comparator
.
- By default the neighbouring vertices of a vertex are listed in
insertion order.
graph.addEdges(a, {d, b, c}); // graph.edges(a): {d, b, c} graph.sortEdges(); // graph.edges(a): {b, c, d}
- Note: In general, adding further graph edges invalidates the sorting of neighbouring vertices.
Implementation
void sortEdges() {
if (comparator == null) return;
for (final vertex in vertices) {
_edges[vertex]!.sort(comparator!);
}
}