sortNode method

void sortNode(
  1. Graph graph,
  2. List<GraphNode> list
)

Implementation

void sortNode(Graph graph, List<GraphNode> list) {
  Map<GraphNode, num> sortMap;
  if (sort != null) {
    sortMap = sort!.call(graph, list);
  } else {
    sortMap = _defaultSort(graph, list);
  }
  list.sort((a, b) {
    num av = sortMap[a] ?? 0;
    num bv = sortMap[b] ?? 0;
    return bv.compareTo(av);
  });
}