Nodes/ComfyUI-ArchiGraph/Slicing Sublist πŸ¦β€πŸ”₯
ComfyUI Node

Slicing Sublist πŸ¦β€πŸ”₯

One slice, applied to every sublist β€” for cutting each clip down to size

By vincentfsΒ·Created 2 years agoΒ·Updated 9 months agoΒ· 3
Slicing Sublist πŸ¦β€πŸ”₯
  • input_list
  • sliced
β—„start0β–Ί
β—„length1β–Ί

This is the sibling of AG Slicing List, and the difference matters. Where that node pulls a chunk out of one flat list, this one takes a list of lists and applies the same slice to every sublist inside it. You give it ten clips of fifty frames each and say "start at 10, length 20" - you get ten clips of twenty frames each, cut from the same position in every clip.

Why you'd reach for it

You reach for it exactly when your data is nested and you want to trim every group uniformly. The classic case is video: a batch of clips, each a list of frames, and you want the same window out of each - drop the first two seconds, keep the next three, discard the rest. Without this node you'd be slicing each sublist with a stack of per-item nodes or a script. With it, one node does the whole batch. It's also handy for paired lists of prompts and filenames where you want to trim every entry to the same range.

How it works

It walks the input list and, for each element, applies sublist[start : start + length]. Two implementation details are worth knowing. First, it accepts a tuple or list, and the output is always a list. Second, it's defensive in a way that can hide bugs: if an element isn't a list or tuple, it doesn't error - it appends an empty list in its place. Your nested structure survives, but you've silently lost that element's content.

The inputs

Identical to Slicing List:

  • input_list - the list of lists to slice. Type *.
  • start - starting index, 0-based. Minimum 0, default 0.
  • length - items per sublist. Minimum 1, default 1.

Output is sliced, a list of sliced sublists.

Installing it

Same pack, same install: ComfyUI Manager β†’ search "ArchiGraph" β†’ install β†’ restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/vincentfs/ComfyUI-ArchiGraph
cd ComfyUI-ArchiGraph
pip install -r requirements.txt   # or install.bat / install.sh

Where people get burned

The main trap is feeding it a flat list. If your "list of lists" is actually just a list of images, this node treats each image as a sublist, fails the list check, and returns a list of empty lists - no error, no warning, just nothing. The empty-list behavior makes silent failure easy, so if your output comes back empty, first check that your input is genuinely nested.

Second, the same caveat as its sibling: output elements are still lists. If you slice each sublist down to one item you still have a list of one-item lists, not a list of items. And remember the direction of the slice applies identically everywhere - there's no way to vary start or length per sublist. For uniform trimming that's exactly right; the moment you need per-group values, this node stops being the answer.

CategoryπŸ¦β€πŸ”₯ ArchiGraph/πŸ› οΈ Utils

Inputs (3)

NameTypeDefaultDescription
input_list*Input list to slice.
startINT0Start index for slicing.
lengthINT1Length for slicing.

Outputs (1)

NameTypeDescription
sliced*β€”