PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ UF_create()

UNIONFIND* UF_create ( uint32_t  N)

Definition at line 34 of file lwunionfind.c.

35 {
36  size_t i;
37  UNIONFIND* uf = lwalloc(sizeof(UNIONFIND));
38  uf->N = N;
39  uf->num_clusters = N;
40  uf->clusters = lwalloc(N * sizeof(uint32_t));
41  uf->cluster_sizes = lwalloc(N * sizeof(uint32_t));
42 
43  for (i = 0; i < N; i++)
44  {
45  uf->clusters[i] = i;
46  uf->cluster_sizes[i] = 1;
47  }
48 
49  return uf;
50 }
void * lwalloc(size_t size)
Definition: lwutil.c:229
uint32_t N
Definition: lwunionfind.h:36
uint32_t * cluster_sizes
Definition: lwunionfind.h:34
uint32_t * clusters
Definition: lwunionfind.h:33
uint32_t num_clusters
Definition: lwunionfind.h:35
unsigned int uint32_t
Definition: uthash.h:78

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

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

Here is the call graph for this function:
Here is the caller graph for this function: