minimumCostEdge static method
Implementation
static Vertex? minimumCostEdge(List<Vertex> vertices ) {
if(vertices.isEmpty) return null;
// O(n * n) approach. TODO optimize this
Vertex least = vertices[0];
for (int i = 0; i < vertices.length; i ++ ) {
if ( vertices[i].collapseCost < least.collapseCost ) {
least = vertices[ i ];
}
}
return least;
}