diff options
Diffstat (limited to 'apps/plugins/puzzles/src/puzzles.h')
-rw-r--r-- | apps/plugins/puzzles/src/puzzles.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/puzzles.h b/apps/plugins/puzzles/src/puzzles.h index 48d3d83b6e..1732abe3e9 100644 --- a/apps/plugins/puzzles/src/puzzles.h +++ b/apps/plugins/puzzles/src/puzzles.h | |||
@@ -595,6 +595,32 @@ bool findloop_run(struct findloopstate *state, int nvertices, | |||
595 | bool findloop_is_loop_edge(struct findloopstate *state, int u, int v); | 595 | bool findloop_is_loop_edge(struct findloopstate *state, int u, int v); |
596 | 596 | ||
597 | /* | 597 | /* |
598 | * Alternative query function, which returns true if the u-v edge is a | ||
599 | * _bridge_, i.e. a non-loop edge, i.e. an edge whose removal would | ||
600 | * disconnect a currently connected component of the graph. | ||
601 | * | ||
602 | * If the return value is true, then the numbers of vertices that | ||
603 | * would be in the new components containing u and v are written into | ||
604 | * u_vertices and v_vertices respectively. | ||
605 | */ | ||
606 | bool findloop_is_bridge( | ||
607 | struct findloopstate *pv, int u, int v, int *u_vertices, int *v_vertices); | ||
608 | |||
609 | /* | ||
610 | * Helper function to sort an array. Differs from standard qsort in | ||
611 | * that it takes a context parameter that is passed to the compare | ||
612 | * function. | ||
613 | * | ||
614 | * I wrap it in a macro so that you only need to give the element | ||
615 | * count of the array. The element size is determined by sizeof. | ||
616 | */ | ||
617 | typedef int (*arraysort_cmpfn_t)(const void *av, const void *bv, void *ctx); | ||
618 | void arraysort_fn(void *array, size_t nmemb, size_t size, | ||
619 | arraysort_cmpfn_t cmp, void *ctx); | ||
620 | #define arraysort(array, nmemb, cmp, ctx) \ | ||
621 | arraysort_fn(array, nmemb, sizeof(*(array)), cmp, ctx) | ||
622 | |||
623 | /* | ||
598 | * Data structure containing the function calls and data specific | 624 | * Data structure containing the function calls and data specific |
599 | * to a particular game. This is enclosed in a data structure so | 625 | * to a particular game. This is enclosed in a data structure so |
600 | * that a particular platform can choose, if it wishes, to compile | 626 | * that a particular platform can choose, if it wishes, to compile |