AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
MyNode.java
Go to the documentation of this file.
1package aud.example.graph;
2
3import aud.graph.SimpleNode;
4
6public class MyNode extends SimpleNode {
7
8 @Override public MyNode create() { // DON'T FORGET THIS !!!
9 return new MyNode();
10 }
11
13 public int ord = -1;
14
16 public MyNode p = null;
17
21 public double d = Double.POSITIVE_INFINITY;
22
24 public double f = Double.POSITIVE_INFINITY;
25
27 public String color = null;
28
29 String fAsString(String prefix) {
30 if (Double.isInfinite(f)) return "";
31 else return prefix+((int) f*10);
32 }
33
34 @Override public String toString() {
35 return super.toString()+
36 " [p="+(p!=null?p.getLabel():"null")+", d="+d+fAsString(", ")+"]";
37 }
38
39 //public String getLabel() { return super.getLabel()+fAsString(":"); }
40
41
42}
node with all possible attributes that we require ;-)
Definition: MyNode.java:6
MyNode create()
Create new node instance.
Definition: MyNode.java:8
double f
priority for A*-algorithm
Definition: MyNode.java:24
MyNode p
node from which node was reached (defines spanning tree)
Definition: MyNode.java:16
String color
color as string
Definition: MyNode.java:27
double d
distance to start node (sum of weighs or edge count if no weights defined)
Definition: MyNode.java:21
int ord
time when node is (first marked/put into front)
Definition: MyNode.java:13
plain simple node
Definition: SimpleNode.java:4
String getLabel()
get text description
Definition: SimpleNode.java:12
Graph data structures and algorithms.
AuD lecture: Data structures, algorithms, examples.
Definition: A234Tree.java:1