32 for (
int i = 0; i < n; i++)
41 while (
deQueue(&Q, &closestVertex)) {
42 closestDist =
dist[closestVertex];
43 for (
size_t i = 1; i <
graph[closestVertex].nedges; i++) {
52 while (
deQueue(&Q, &closestVertex)) {
53 closestDist =
dist[closestVertex];
54 for (
size_t i = 1; i <
graph[closestVertex].nedges; i++) {
67 for (
int i = 0; i < n; i++)
69 dist[i] = closestDist + 10;
88 qp->
data[0] = startVertex;
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
void bfs(int vertex, vtx_data *graph, int n, DistType *dist)
void initQueue(Queue *qp, int startVertex)
void freeQueue(Queue *qp)
void mkQueue(Queue *qp, int size)
bool deQueue(Queue *qp, int *vertex)
bool enQueue(Queue *qp, int vertex)
static double dist(int dim, double *x, double *y)
Agraph_t * graph(char *name)
#define neighbor(t, i, edim, elist)