Connector Symbols Misclassified as Components After SVG Import
TLDR
Junction dots imported from external vector applications (like Inkscape or Illustrator) are frequently exported as unclassed<path> elements. Class-matching classifiers default to labeling them as generic components, breaking wire topology netlist analysis. Calculating path circularity ($4\pi A / P^2$) correctly identifies circular junction paths ($Q \approx 0.98 > 0.65$), restoring accurate connector classification without relying on class names.
| Input Source | SVG Tag & Attribute Structure | Class-Based Classifier | Geometry Classifier ($Q > 0.65$) |
|---|---|---|---|
| Native Web Tool | <circle class="junction"> | connector | connector |
| Exported Inkscape SVG | <path d="M..." /> (No class) | component (DEFECT) | connector ($Q \approx 0.98$) |
Problem statement: the broken connection bug in imported schematics
When importing circuit schematics from third-party design suites, 3-way wire junctions (small filled circles where conductors intersect) appeared visually intact on the canvas.
However, netlist topology analysis treated the intersecting wires as disconnected. The exporter generated broken netlists and incorrect Bills of Materials (BOM) because the classifier failed to recognize imported junction dots as connector nodes.
Technical failure mode: hardcoded class & tag name matching
The legacy classifier checked tag names and class strings directly:
// DEFECTIVE IMPLEMENTATION: Fails for path-based circles without class metadata
function classify(el) {
if (el.classList.contains('junction')) return 'connector';
if (el.tagName === 'circle') return 'connector';
return 'component'; // Catches imported unclassed <path> junction circles!
}
Because tools like Inkscape convert circles into cubic Bezier <path> elements on export and omit application-specific class names, the classifier defaulted to labeling them as component nodes.
The fix: path circularity & linearity ratios
We replaced class matching with geometric metrics calculated from flattened path coordinates:
// REFACTORED: Geometry-based classification fallback
function classifyByGeometry(points, isClosed) {
const len = computePathLength(points);
if (len === 0) return 'unknown';
// 1. Linearity check (Cheap calculation): high linearity = wire const span = Math.hypot( points[points.length - 1].x - points[0].x, points[points.length - 1].y - points[0].y ); if (span / len > 0.85 && !isClosed) return 'wire';
// 2. Circularity check for closed paths (Circularity > 0.65 = connector dot) if (isClosed) { const area = Math.abs(computeSignedArea(points)); const circularity = (4 Math.PI area) / (len * len); if (circularity > 0.65) { return 'connector'; // Path-approximated circle scores ~0.98 } }
return 'component'; }
Circularity scores by geometry type
- Path-Approximated Circle: $\sim 0.98$ (Classified as
connector) - Square Bounding Box: $\pi/4 \approx 0.785$
- Resistor Outline: $\sim 0.15$ (Classified as
component)
Rule of thumb: Never trust tag names or CSS classes when parsing imported vector files. Use path circularity ($4\pi A / P^2$) to classify circular connector nodes reliably.