Sort returns a slice of the edges in the map, in a consistent order. The sort order is first based on the edge weight (higher-to-lower) and then by the node names to avoid flakiness.
()
| 1134 | // order. The sort order is first based on the edge weight |
| 1135 | // (higher-to-lower) and then by the node names to avoid flakiness. |
| 1136 | func (e EdgeMap) Sort() []*Edge { |
| 1137 | el := make(edgeList, 0, len(e)) |
| 1138 | for _, w := range e { |
| 1139 | el = append(el, w) |
| 1140 | } |
| 1141 | |
| 1142 | sort.Sort(el) |
| 1143 | return el |
| 1144 | } |
| 1145 | |
| 1146 | // Sum returns the total weight for a set of nodes. |
| 1147 | func (e EdgeMap) Sum() int64 { |