MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / path_cmp

Function path_cmp

src/procedures/proc_sp_paths.c:506–521  ·  view source on GitHub ↗

compare path by weight, cost and path length

Source from the content-addressed store, hash-verified

504
505// compare path by weight, cost and path length
506static int path_cmp
507(
508 const void *a,
509 const void *b,
510 void *udata
511) {
512 WeightedPath *da = (WeightedPath *)a;
513 WeightedPath *db = (WeightedPath *)b;
514 if(da->weight == db->weight) {
515 if(da->cost == db->cost) {
516 return Path_Len(da->path) - Path_Len(db->path);
517 }
518 return da->cost - db->cost;
519 }
520 return da->weight - db->weight;
521}
522
523// get all minimal paths (all paths with the same weight)
524static void SPpaths_all_minimal

Callers

nothing calls this directly

Calls 1

Path_LenFunction · 0.85

Tested by

no test coverage detected