forked from premaseem/AlgorithmAndDataStructureInJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphNode.java
More file actions
executable file
·66 lines (50 loc) · 1.14 KB
/
GraphNode.java
File metadata and controls
executable file
·66 lines (50 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package dsGuy.node;
import java.util.*;
public class GraphNode {
private String name;
private int index; //index is used to map this Node's name with index of Adjacency Matrix' cell#
private ArrayList<GraphNode> neighbors = new ArrayList<GraphNode>();
private boolean isVisited = false;
private GraphNode parent;
public GraphNode(String name, int index) {
this.name = name;
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public ArrayList<GraphNode> getNeighbors() {
return neighbors;
}
public void setNeighbors(ArrayList<GraphNode> neighbors) {
this.neighbors = neighbors;
}
public boolean isVisited() {
return isVisited;
}
public void setVisited(boolean isVisited) {
this.isVisited = isVisited;
}
public GraphNode getParent() {
return parent;
}
public void setParent(GraphNode parent) {
this.parent = parent;
}
public GraphNode(String name) {
this.name = name;
}
@Override
public String toString() {
return name ;
}
}