UUnionPebble
AI coding workspace

Disjoint component grouping

A connection changes which nodes belong together. UnionPebble helps you reason about disjoint sets from source files and small graph fixtures, with model suggestions remaining available for code review.

● ● ●UnionPebble●
A concrete starting point · Disjoint component grouping ×
def components(count, edges):
    if type(count) is not int or not 0 <= count <= 10000:
        raise ValueError("node count")
    pairs = list(edges)
    for pair in pairs:
        if len(pair) != 2 or any(type(v) is not int or not 0 <= v < count for v in pair):
            raise ValueError("edge endpoint")
    parent = list(range(count))
    def find(x):
        while parent[x] != x:
            parent[x] = parent[parent[x]]
            x = parent[x]
        return x
    for a, b in pairs:
        parent[find(b)] = find(a)
    groups = {}
    for node in range(count): groups.setdefault(find(node), []).append(node)
    return sorted(groups.values())
✳Group numbered nodes by undirected connections with a disjoint-set structure.
✓ ChangesReview before applying ↗
Illustrative workspace
01

Review before applying

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

02

Connection

Base URL, credentials and a reachable server.

03

Project

Check isolated nodes, repeated edges and an empty graph, rejecting invalid endpoints before joining any component.

Workflows

Disjoint component grouping

Workflows ↗
A concrete starting point
def components(count, edges):
    if type(count) is not int or not 0 <= count <= 10000:
        raise ValueError("node count")
    pairs = list(edges)
    for pair in pairs:
        if len(pair) != 2 or any(type(v) is not int or not 0 <= v < count for v in pair):
            raise ValueError("edge endpoint")
    parent = list(range(count))
    def find(x):
        while parent[x] != x:
            parent[x] = parent[parent[x]]
            x = parent[x]
        return x
    for a, b in pairs:
        parent[find(b)] = find(a)
    groups = {}
    for node in range(count): groups.setdefault(find(node), []).append(node)
    return sorted(groups.values())
AI coding workspace

Turn grouping requirements into a reviewable software change

UnionPebble is a Windows AI coding workspace for bringing a grouping requirement, its source code and its consumers into one development conversation. Start by describing what the application considers connected and what it expects to receive. Ask the model to inspect the existing representation before suggesting changes to the code that creates groups.

For a concrete task, use components.py to discuss a connection that joins two previously separate groups. Include an isolated node in the fixture and state the expected output ordering. The example helps you formulate a change request without assuming that a mathematically equivalent collection will satisfy the application’s serializer or display code.

Review the proposal at those boundaries. Check accepted node identifiers, invalid edges and the empty case, then run the relevant project checks. A useful result should explain both why members belong together and why the returned structure fits its consumer. Keep unrelated storage or interface changes outside a request intended to fix grouping behavior.

Connect a model through a supported OpenAI-compatible or Anthropic endpoint, supplying credentials where required. If that service offers an abliterated AI model, it is an option for the session; restrictions remain provider-dependent. Available tools and context also depend on the model and server, so scope the inspection to source and evidence the session can actually use.

Grouping work beyond a happy-path example

Do isolated nodes belong in the output?

Set that expectation explicitly. A list of edges may never mention an isolated node, even though the application still knows it exists. Include the declared node count and an isolated fixture so the proposed code cannot quietly discard such entries from the result.

Can equivalent group orderings break a caller?

Yes, if a consumer relies on stable serialization, comparison or presentation order. State whether ordering is part of the interface, then inspect the output convention. Mathematical equivalence does not by itself prove compatibility with snapshots or downstream processing in your project.

What should happen to an out-of-range endpoint?

Define the rejected-input behavior and inspect where it is surfaced. The example validates identifiers against the declared node count. Review the caller’s response instead of assuming an exception alone communicates a useful error to whoever supplied the grouping data.

How do I check a connection that merges groups?

Write the initial groups and the expected merged membership independently, including an unaffected group. Run the fixture through the changed code and inspect ordering separately. This gives the review a concrete before-and-after result without repeating the implementation inside the test.

Get the Windows app ↗

UnionPebble · Updated 2026-10-25