public static void recalculatePorts(
      final CanonicMultiStageLayouter layouter, final Graph2D graph) {
    // Effect: Ensures that ports are drawn onto node borders, and not onto the node center. (Only
    // Circular layout!)
    // Justification: Circular layout uses as the standard port the center of the node, this will be
    // corrected by
    // calling the following function.
    // Exclusion: Port of nodes with non rectangle shapes, have to be additionally recalculated.

    if (layouter instanceof CircularLayouter) {
      // Port correction
      LayoutTool.clipEdgesOnBB(graph);

      // Recalculate ports (necessary for circular proximity nodes)
      final PortCalculator pc = new PortCalculator();
      final NodeRealizerIntersectionCalculator nrics =
          new NodeRealizerIntersectionCalculator(graph, true);
      graph.addDataProvider(IntersectionCalculator.SOURCE_INTERSECTION_CALCULATOR_DPKEY, nrics);
      final NodeRealizerIntersectionCalculator nrict =
          new NodeRealizerIntersectionCalculator(graph, false);
      graph.addDataProvider(IntersectionCalculator.TARGET_INTERSECTION_CALCULATOR_DPKEY, nrict);

      pc.doLayout(graph);
    }
  }
Layouts the graph using the last set layouter that was passed to setLayouter.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/functions/LayoutFunctions.java