Graphviz 13.1.3~dev.20250815.1023
|
#include <assert.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/gv_math.h>
#include <util/list.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))) |
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) |
|
static |
Definition at line 243 of file closest.c.
Referenced by construct_graph().
void closest_pairs2graph | ( | double * | place, |
int | n, | ||
int | num_pairs, | ||
vtx_data ** | graph | ||
) |
Definition at line 310 of file closest.c.
References construct_graph(), find_closest_pairs(), graph(), and num_pairs.
Referenced by iterativePCA_1D().
|
static |
Definition at line 156 of file closest.c.
Referenced by find_closest_pairs().
|
static |
Definition at line 260 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 128 of file closest.c.
References PairHeap::data, heapify(), and PairHeap::heapSize.
Referenced by find_closest_pairs().
|
static |
Definition at line 170 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 105 of file closest.c.
References PairHeap::data, and free().
Referenced by find_closest_pairs().
|
static |
Definition at line 86 of file closest.c.
References PairHeap::data, greaterPriority, insideHeap, left, right, and SWAP.
Referenced by extractMax(), and initHeap().
|
static |
Definition at line 110 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 140 of file closest.c.
References PairHeap::data, edge, greaterPriority, gv_recalloc(), PairHeap::heapSize, PairHeap::maxSize, parent, and SWAP.
Referenced by Blocks::Blocks(), find_closest_pairs(), Block::findMinInConstraint(), and Blocks::split().
|
static |
|
static |
Definition at line 42 of file closest.c.
References copy(), and gv_alloc().
Referenced by find_closest_pairs().