assignX method

void assignX()

Implementation

void assignX() {
  // Simplified coordinate assignment - can be enhanced with full Brandes-Köpf algorithm
  var separation = configuration.nodeSeparation;
  var vertical = isVertical();

  for (var layerIndex = 0; layerIndex < layers.length; layerIndex++) {
    var layer = layers[layerIndex];
    var x = 0.0;

    for (var nodeIndex = 0; nodeIndex < layer.length; nodeIndex++) {
      var node = layer[nodeIndex];
      var width = vertical ? node.width + separation : node.height;
      node.x = x + width / 2;
      x += width + separation;
    }
  }
}