Graphviz 13.0.0~dev.20241220.2304
|
#include <assert.h>
#include <cgraph/list.h>
#include <limits.h>
#include <neatogen/kkutils.h>
#include <neatogen/closest.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <util/alloc.h>
#include <util/sort.h>
Go to the source code of this file.
Data Structures | |
struct | Pair |
struct | PairHeap |
Macros | |
#define | LT(p, q) ((p).dist < (q).dist) |
#define | EQ(p, q) ((p).dist == (q).dist) |
#define | sub(h, i) (*pairs_get((h), (i))) |
#define | left(i) (2*(i)) |
#define | right(i) (2*(i)+1) |
#define | parent(i) ((i)/2) |
#define | insideHeap(h, i) ((i)<h->heapSize) |
#define | greaterPriority(h, i, j) (LT(h->data[i],h->data[j]) || ((EQ(h->data[i],h->data[j])) && (rand()%2))) |
#define | exchange(h, i, j) |
Functions | |
static void | push (pairs_t *s, Pair x) |
static bool | pop (pairs_t *s, Pair *x) |
static void | heapify (PairHeap *h, size_t i) |
static void | freeHeap (PairHeap *h) |
static void | initHeap (PairHeap *h, double *place, size_t *ordering, size_t n) |
static bool | extractMax (PairHeap *h, Pair *max) |
static void | insert (PairHeap *h, Pair edge) |
static int | cmp (const void *a, const void *b, void *context) |
static void | find_closest_pairs (double *place, size_t n, int num_pairs, pairs_t *pairs_stack) |
static void | add_edge (vtx_data *graph, int u, int v) |
static void | construct_graph (size_t n, pairs_t *edges_stack, vtx_data **New_graph) |
void | closest_pairs2graph (double *place, int n, int num_pairs, vtx_data **graph) |
#define exchange | ( | h, | |
i, | |||
j | |||
) |
|
static |
Definition at line 248 of file closest.c.
Referenced by construct_graph().
void closest_pairs2graph | ( | double * | place, |
int | n, | ||
int | num_pairs, | ||
vtx_data ** | graph | ||
) |
Definition at line 315 of file closest.c.
References construct_graph(), find_closest_pairs(), graph(), and num_pairs.
Referenced by iterativePCA_1D().
|
static |
Definition at line 161 of file closest.c.
Referenced by find_closest_pairs().
|
static |
Definition at line 265 of file closest.c.
References add_edge(), vtx_data::edges, vtx_data::ewgts, free(), gv_calloc(), vtx_data::nedges, pop(), sub, and top().
Referenced by closest_pairs2graph().
Definition at line 133 of file closest.c.
References PairHeap::data, heapify(), and PairHeap::heapSize.
Referenced by find_closest_pairs().
|
static |
Definition at line 175 of file closest.c.
References cmp(), extractMax(), free(), freeHeap(), gv_calloc(), gv_sort(), initHeap(), insert(), left, neighbor, num_pairs, push(), and right.
Referenced by closest_pairs2graph().
|
static |
Definition at line 110 of file closest.c.
References PairHeap::data, and free().
Referenced by find_closest_pairs().
|
static |
Definition at line 91 of file closest.c.
References exchange, greaterPriority, insideHeap, left, and right.
Referenced by extractMax(), and initHeap().
|
static |
Definition at line 115 of file closest.c.
References PairHeap::data, edge, gv_calloc(), heapify(), PairHeap::heapSize, PairHeap::maxSize, and SIZE_MAX.
Referenced by find_closest_pairs().
Definition at line 145 of file closest.c.
References PairHeap::data, edge, exchange, greaterPriority, gv_recalloc(), PairHeap::heapSize, PairHeap::maxSize, and parent.
Referenced by Blocks::Blocks(), find_closest_pairs(), Block::findMinInConstraint(), and Blocks::split().
|
static |
|
static |
Definition at line 41 of file closest.c.
References copy(), and gv_alloc().
Referenced by find_closest_pairs().