Skip to content
Astera Technology

Separate near-duplicate case families across evaluation pools

Validate partitions over transitive components derived from declared near-duplicate links.

Download complete case notes and answer keys ↓

Define the local evaluation task

A synthetic evaluation split supplies unique nonblank text case IDs compared exactly, development/reserved assignments and undirected declared near-duplicate links, each containing exactly two endpoints. Self-links and repeated binary links are allowed but add no new connectivity. Derive transitive connected components; every member of a component must use one partition. Links are supplied evidence, not inferred similarity. Unknown link endpoints or missing assignments invalidate the split before component checks.

  1. Validate declared link endpoints and assignments
  2. Traverse undirected transitive components
  3. Check one partition per complete component

Mixed components need reassignment or revised declared links, retaining the original audit.

Use the filled cases

Original synthetic input and literal answer key
CaseSupplied inputExpected structured outputDecision and reason
Indirect link crosses split{"cases":[{"id":"A","partition":"development"},{"id":"B","partition":"development"},{"id":"C","partition":"reserved"}],"links":[["A","B"],["B","C"]]}{"components":[["A","B","C"]],"mixed":[["A","B","C"]],"valid":false}A links to C through B; checking only direct A/C pairs would miss the shared component.
Two components kept separate{"cases":[{"id":"A","partition":"development"},{"id":"B","partition":"development"},{"id":"C","partition":"reserved"}],"links":[["A","B"]]}{"components":[["A","B"],["C"]],"mixed":[],"valid":true}A/B remain development and isolated C remains reserved.
A link has three endpoints{"cases":[{"id":"A","partition":"development"},{"id":"B","partition":"development"}],"links":[["A","B","Z"]]}{"error":"split-input"}Reject the nonbinary link before traversal; Z must not be silently discarded.
Component member has no case ID{"cases":[{"partition":"reserved"}],"links":[]}{"error":"split-input"}An undefined member cannot establish a valid declared case component.
Link endpoint not registered{"cases":[{"id":"A","partition":"development"}],"links":[["A","Z"]]}{"error":"split-input"}Z has no case assignment; derive no silently incomplete component.
Download editable CSV ↓

Work the undeclared-endpoint case. Which output is required, and why?

Show the worked answer

{"error":"split-input"} — Z has no case assignment; derive no silently incomplete component.

Run the self-contained evaluator

Save as .mjs and run with Node.js; supplied fixtures only
import assert from 'node:assert/strict';

function evaluate(x){
 const ids=x.cases.map(c=>c.id),by=new Map(x.cases.map(c=>[c.id,c.partition]));if(new Set(ids).size!==ids.length||x.cases.some(c=>typeof c.id!=='string'||!c.id.trim()||!['development','reserved'].includes(c.partition))||x.links.some(link=>!Array.isArray(link)||link.length!==2||!by.has(link[0])||!by.has(link[1])))return {error:'split-input'};
 const adjacency=new Map(ids.map(id=>[id,[]]));for(const [a,b] of x.links){adjacency.get(a).push(b);adjacency.get(b).push(a);}
 const seen=new Set(),components=[];for(const root of [...ids].sort())if(!seen.has(root)){const component=[],queue=[root];seen.add(root);while(queue.length){const id=queue.shift();component.push(id);for(const next of adjacency.get(id))if(!seen.has(next)){seen.add(next);queue.push(next);}}components.push(component.sort());}
 const mixed=components.filter(c=>new Set(c.map(id=>by.get(id))).size>1);return {components,mixed,valid:mixed.length===0};
}

const cases = [
  {
    "id": "transitive-crossing",
    "input": {
      "cases": [
        {
          "id": "A",
          "partition": "development"
        },
        {
          "id": "B",
          "partition": "development"
        },
        {
          "id": "C",
          "partition": "reserved"
        }
      ],
      "links": [
        [
          "A",
          "B"
        ],
        [
          "B",
          "C"
        ]
      ]
    },
    "expected": {
      "components": [
        [
          "A",
          "B",
          "C"
        ]
      ],
      "mixed": [
        [
          "A",
          "B",
          "C"
        ]
      ],
      "valid": false
    }
  },
  {
    "id": "separate-components",
    "input": {
      "cases": [
        {
          "id": "A",
          "partition": "development"
        },
        {
          "id": "B",
          "partition": "development"
        },
        {
          "id": "C",
          "partition": "reserved"
        }
      ],
      "links": [
        [
          "A",
          "B"
        ]
      ]
    },
    "expected": {
      "components": [
        [
          "A",
          "B"
        ],
        [
          "C"
        ]
      ],
      "mixed": [],
      "valid": true
    }
  },
  {
    "id": "three-endpoint-record",
    "input": {
      "cases": [
        {
          "id": "A",
          "partition": "development"
        },
        {
          "id": "B",
          "partition": "development"
        }
      ],
      "links": [
        [
          "A",
          "B",
          "Z"
        ]
      ]
    },
    "expected": {
      "error": "split-input"
    }
  },
  {
    "id": "component-case-id-absent",
    "input": {
      "cases": [
        {
          "partition": "reserved"
        }
      ],
      "links": []
    },
    "expected": {
      "error": "split-input"
    }
  },
  {
    "id": "undeclared-endpoint",
    "input": {
      "cases": [
        {
          "id": "A",
          "partition": "development"
        }
      ],
      "links": [
        [
          "A",
          "Z"
        ]
      ]
    },
    "expected": {
      "error": "split-input"
    }
  }
];
for (const c of cases) assert.deepEqual(evaluate(c.input), c.expected, c.id);
console.log(JSON.stringify({checked:cases.length,caseIds:cases.map(c=>c.id)}));
Download runnable example ↓

Save the declared links and computed component membership with the split file. This validator cannot detect undeclared similarity and does not claim statistical independence merely because the graph passes.

Related resources