ComfyUI Node

is superset

Does A contain all of B? The flip side of the containment check

By StableLlama·Created about a year ago·Updated 4 days ago· 48
is superset
  • set1
  • set2
  • is_superset

is superset is the mirror image of this pack's is subset: it checks whether set1 contains every element of set2. If yes, True; if any element of set2 is missing from set1, False. One boolean out, and it answers the question "is this pool big enough to cover that one?"

You'll reach for it when the containment question runs in the other direction from the subset node. A classic use: you have a master tag pool and a required-list of tags - is the master pool a superset of the required list? Or you're gating a workflow on "do we have all the ingredients" before running a generation branch. Since it emits a plain BOOLEAN, wire it into this pack's if/else, flow select, or switch/case nodes and you've got conditional logic without any custom scripting.

How it works

The mechanism is Python's set1.issuperset(set2): every element of set2 is tested for membership in set1. Like the subset node, it's a pure read - nothing copied, nothing mutated, just a membership check and a boolean out. It's the mathematical converse of issubset, so you could reach the same answer by swapping inputs on the other node - but why fight the naming.

Python's semantics are worth a moment:

  • A set is a superset of itself. True for set1 == set2. If you need strictly larger, compare length alongside.
  • Every set is a superset of the empty set. An empty set2 yields True no matter what set1 is. That's mathematically correct, but it can silently pass a validation that "the required list is empty" should probably fail - keep length in mind.

Inputs and output

  • set1 (SET) - the set being checked as the container.
  • set2 (SET) - the set that must be fully contained.
  • is_superset (BOOLEAN, output) - True when set1 contains all of set2.

Two required inputs, one boolean out. Direction matters: set1 is the container here, so set1 = {a, b, c} and set2 = {a, b} returns True, while the reversed pairing does not.

Installing

It's in Basic data handling by StableLlama. ComfyUI Manager - search "Basic data handling", install, restart - is the fastest route. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart ComfyUI after either method. The pack declares no dependencies and downloads no models, so this is a genuinely painless install.

Common issues

The recurring gotcha across this whole comparison family is exactness: membership is decided by value equality, so "tag" vs "tag " or "Tag" won't match. Normalize before comparing if your sources aren't consistent. And if the node's output feels inverted, double-check which set you put in set1 - the container - because that's the whole difference between this node and is subset.

CategoryBasic/SET

Inputs (2)

NameTypeDefaultDescription
set1SET
set2SET

Outputs (1)

NameTypeDescription
is_supersetBOOLEAN