Fix duplicate node IDs and visualization.