コード例 #1
0
  public void drawNodes(
      Graphics screen, AdjacencyListGraph<Point2D.Double, Double> graph, int minDimension) {
    screen.drawString("PUT YOUR NAME HERE", 20, 20);

    for (Vertex u : graph.vertices()) {
      Point2D p = (Point2D) u.element();

      double xPos = p.getX() * minDimension;
      double yPos = p.getY() * minDimension;

      screen.fillOval((int) xPos, (int) yPos, DOTRADIUS, DOTRADIUS);

      screen.drawString(
          ((String) u.get(GraphAlgorithm.NAME)) + "",
          (int) (xPos + DOTRADIUS),
          (int) (yPos + DOTRADIUS));
    }
  }