Dijkstra Algorithm view (Node, Edges)

OK here is a very simple Node class that you can start with

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);
  }
}

Note the ctor is only used to create the node and the display() method can be called from inside draw()

2 Likes