PostGIS  2.2.7dev-r@@SVN_REVISION@@
UNIONFIND* UF_create ( uint32_t  N)

Definition at line 21 of file lwunionfind.c.

References UNIONFIND::cluster_sizes, UNIONFIND::clusters, lwalloc(), UNIONFIND::N, and UNIONFIND::num_clusters.

Referenced by cluster_intersecting(), cluster_within_distance(), test_unionfind_create(), test_unionfind_path_compression(), and test_unionfind_union().

22 {
23  size_t i;
24  UNIONFIND* uf = lwalloc(sizeof(UNIONFIND));
25  uf->N = N;
26  uf->num_clusters = N;
27  uf->clusters = lwalloc(N * sizeof(uint32_t));
28  uf->cluster_sizes = lwalloc(N * sizeof(uint32_t));
29 
30  for (i = 0; i < N; i++)
31  {
32  uf->clusters[i] = i;
33  uf->cluster_sizes[i] = 1;
34  }
35 
36  return uf;
37 }
uint32_t * clusters
Definition: lwunionfind.h:20
uint32_t * cluster_sizes
Definition: lwunionfind.h:21
uint32_t N
Definition: lwunionfind.h:23
uint32_t num_clusters
Definition: lwunionfind.h:22
void * lwalloc(size_t size)
Definition: lwutil.c:199

Here is the call graph for this function:

Here is the caller graph for this function: