mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
b5da85e85d
The global is an *internal* hack because dijkstra_item_mover doesn't take a context arg! It should be used with care. Easy, since all the accessors exist: we just hand in the struct dijkstra. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
#ifndef LIGHTNING_PLUGINS_RENEPAY_DIJKSTRA_H
|
|
#define LIGHTNING_PLUGINS_RENEPAY_DIJKSTRA_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
#include <ccan/tal/tal.h>
|
|
#include <gheap.h>
|
|
|
|
/* Allocation of resources for the heap. */
|
|
struct dijkstra *dijkstra_new(const tal_t *ctx, size_t max_num_nodes);
|
|
|
|
/* Initialization of the heap for a new Dijkstra search. */
|
|
void dijkstra_init(struct dijkstra *dijkstra);
|
|
|
|
/* Inserts a new element in the heap. If node_idx was already in the heap then
|
|
* its distance value is updated. */
|
|
void dijkstra_update(struct dijkstra *dijkstra, u32 node_idx, s64 distance);
|
|
|
|
u32 dijkstra_top(const struct dijkstra *dijkstra);
|
|
bool dijkstra_empty(const struct dijkstra *dijkstra);
|
|
void dijkstra_pop(struct dijkstra *dijkstra);
|
|
|
|
const s64* dijkstra_distance_data(const struct dijkstra *dijkstra);
|
|
|
|
/* Number of elements on the heap. */
|
|
size_t dijkstra_size(const struct dijkstra *dijkstra);
|
|
|
|
/* Maximum number of elements the heap can host */
|
|
size_t dijkstra_maxsize(const struct dijkstra *dijkstra);
|
|
|
|
#endif /* LIGHTNING_PLUGINS_RENEPAY_DIJKSTRA_H */
|