-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphNode.cs
47 lines (41 loc) · 1011 Bytes
/
GraphNode.cs
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
using System;
namespace DataStructures
{
class GraphNode
{
private GraphNode[] adjacent;
public int AdjacentCount;
private String vertex;
public State state;
public GraphNode(String vertex, int adjacentLength)
{
this.vertex = vertex;
AdjacentCount = 0;
adjacent = new GraphNode[adjacentLength];
}
public void AddAdjacent(GraphNode x)
{
if (AdjacentCount < 30)
{
adjacent[AdjacentCount] = x;
AdjacentCount++;
}
else
{
Console.WriteLine("No more adjacent can be added");
}
}
public GraphNode[] GetAdjacent()
{
return adjacent;
}
public String GetVertex()
{
return vertex;
}
}
public enum State
{
Unvisited, Visited, Visiting
}
}