<commit_before>A generic disjoint-set implementation, AKA union-find set.
==========================================================

The implemention is a "Disjoint-set forest" with the enhancements "union by rank" and "path compression" as described on the Wikipedia page *Disjoint-set data structure* http://en.wikipedia.org/wiki/Disjoint-set_data_structure.

Usage
-----

Copy `unionfind.h` to your project. Add an `UF_handle_t` with the name `uf_handle` to any struct to make it unifiable. Use the macros `UF_MAKESET`, `UF_UNION` and `UF_FIND`.

Example
-------

```C
include <assert.h>
include "unionfind.h"

struct foo {
	UF_handle_t uf_handle;
	/* ... */
};

int main() {
	struct foo a;
	struct foo b;
	struct foo *representative_a;
	struct foo *representative_b;

	/* Create a singleton sets for each of a and b */
	UF_MAKESET(struct foo, &a);
	UF_MAKESET(struct foo, &b);

	/* Unify a and b, i.e. join their sets */
	UF_UNION(struct foo, &a, &b);

	/* If a and b are in the same set, they have the same representative */
	UF_FIND(struct foo, representative_a, &a);
	UF_FIND(struct foo, representative_b, &b);
	assert(representative_a == representative_b);

	return 0;
}
```

See `test.c` for another example.<commit_msg>Minor README changes<commit_after>unionfind.h
===========

A generic disjoint-set AKA union-find.

Implementation
--------------

The implemention is a "Disjoint-set forest" with the enhancements "union by rank" and "path compression" as described on the Wikipedia page *Disjoint-set data structure* http://en.wikipedia.org/wiki/Disjoint-set_data_structure.

Usage
-----

Copy `unionfind.h` to your project. Add an `UF_handle_t` with the name `uf_handle` to any struct to make it unifiable. Use the macros `UF_MAKESET`, `UF_UNION` and `UF_FIND`.

Example
-------

```C
include <assert.h>
include "unionfind.h"

struct foo {
	UF_handle_t uf_handle;
	/* ... */
};

int main() {
	struct foo a;
	struct foo b;
	struct foo *representative_a;
	struct foo *representative_b;

	/* Create a singleton set for each of a and b */
	UF_MAKESET(struct foo, &a);
	UF_MAKESET(struct foo, &b);

	/* Unify a and b, i.e. join their sets together */
	UF_UNION(struct foo, &a, &b);

	/* If a and b are in the same set, they have the same representative */
	UF_FIND(struct foo, representative_a, &a);
	UF_FIND(struct foo, representative_b, &b);
	assert(representative_a == representative_b);

	return 0;
}
```

See `test.c` for another example.
{'fraction_non_alphanumeric': 0.150489396411093, 'fraction_numerical': 0.0008156606851549756, 'mean_word_length': 4.026639344262295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5744264', 'n_tokens_mistral': 867, 'n_tokens_neox': 832, 'n_words': 286}