is disjoint
Do these two sets have zero overlap? One boolean says it all
- set1
- set2
- is_disjoint
is disjoint answers one question: do these two sets have no elements in common? If the overlap is empty it outputs True; if they share even one element, False. It's a boolean gate in the form of a set operation, and it's the cleanest way to branch a workflow on "these two pools never touch."
Think of it as the negative-image of this pack's intersection. Intersection gives you the actual shared elements; is disjoint just tells you whether there are any. When you only need the yes/no - not the list - this node is the cheaper, clearer choice. Real uses: check that a prompt-tag set and a banned-token set have no overlap before generating, verify two style categories don't collide, or gate a fallback path when two condition sets turn out to be mutually exclusive.
How it works
The mechanism is Python's set1.isdisjoint(set2) - an O(min(len(a), len(b))) membership test that short-circuits the moment it finds a shared element. No full comparison, no copying, no new set built. It returns a single BOOLEAN you can wire directly into this pack's control-flow nodes - if/else, flow select - or into any other boolean input in the graph.
Two edge cases worth internalizing:
- Two empty sets are disjoint.
{}and{}share nothing, so the answer isTrue. If you care about "both empty" as a different case, check length on both separately. - It's symmetric. A disjoint B means B disjoint A. Unlike difference, direction doesn't matter here.
Inputs and output
set1(SET) - first set.set2(SET) - second set.is_disjoint(BOOLEAN, output) -Truewhen the sets share no elements,Falseotherwise.
Both inputs required, one boolean out. Simple enough that there's genuinely nothing else to configure.
Installing
It's in Basic data handling by StableLlama. ComfyUI Manager is easiest - search "Basic data handling", install, restart. Or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart ComfyUI after either path. No dependencies and no models, consistent with the rest of this pure-Python pack.
Common issues
The trap here is expecting it to catch similar values. "Disjoint" means no identical elements - "red" and "red " (trailing space) are different strings, so sets containing them would count as disjoint even though a human would call them the same. If your sources are inconsistent, normalize (trim, casefold) before the test. Otherwise this node is about as failure-proof as the pack gets.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| set1 | SET | — | |
| set2 | SET | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| is_disjoint | BOOLEAN | — |