ists
    if (links.some(l => (l.source === fromLabel && l.target === toLabel) ||
      (l.source === toLabel && l.target === fromLabel))) {
      console.log(`Link between ${fromLabel} and ${toLabel} already exists`);
      return;
    }

    // Add to links array
    const newLink = {
      source: fromLabel,
      target: toLabel
    };

    links.push(newLink);

    // Mark both nodes as highlighted
    highlightedNodes.add(fromLabel);
    highlightedNodes.add(toLabel);

    // Update the visualization (