Dijkstra Algorithm view (Node, Edges)

Like this

Node n0, n1;

void setup() {
  size(400, 400);
  n0 = new Node(89.7, 123.55);
  n1 = new Node(341.34, 289.01);
}

void draw() {
  background(200, 255, 200);
  n0.display();
  n1.display();
}

public class Node {
  private float x;
  private float y;

  public Node(float x, float y) {
    this.x = x;
    this.y = y;
  }

  public void display() {
    strokeWeight(2);
    stroke(0); // black
    fill(0, 255, 0);
    ellipse(x, y, 16, 16);
  }
}

Just because something works doesn’t make it right - remember

1 Like