# Dijkstra Algorithm view (Node, Edges)

**URL:** <https://discourse.processing.org/t/dijkstra-algorithm-view-node-edges/26891>\
**Category:** Coding Questions\
**Created:** [January 8, 2021, 5:22pm UTC](https://discourse.processing.org/t/dijkstra-algorithm-view-node-edges/26891 "2021-01-08T17:22:58Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [January 9, 2021, 3:39pm UTC](https://discourse.processing.org/t/dijkstra-algorithm-view-node-edges/26891/21 "2021-01-09T15:39:04Z")

</div>

> [@Chrisir](#):
>
> I would argue the second statement (never process mouse input in the constructor)

I didn’t explain myself very well I have no issue whatsoever with

```auto
void mousePressed() {
   nodes.add(new Node(mouseX,mouseY));
}

```

because you are not actually reading mouse input inside the ctor, you are simply passing mouse data as parameters.

I would have a serious issue with

```auto
  void mousePressed() {
     nodes.add(new Node());
  }
  
// And inside the class
public Node(){
    this.x = mouseX;
    this.y = mouseY;
  }

```

[Previous page](https://discourse.processing.org/t/dijkstra-algorithm-view-node-edges/26891.md?page=1)
