-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphNode.cs
More file actions
44 lines (38 loc) · 933 Bytes
/
GraphNode.cs
File metadata and controls
44 lines (38 loc) · 933 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Graph
{
public class GraphNode<T>
{
private T id;
private LinkedList<T> adjList;
private LinkedList<int> weights;
public GraphNode(T id)
{
this.id = id;
adjList = new LinkedList<T>();
weights = new LinkedList<int>();
}
public T ID
{
get { return id; }
set { id = value; }
}
public void AddEdge(GraphNode<T> to, int weight)
{
adjList.AddLast(to.ID);
weights.AddLast(weight);
}
public LinkedList<T> GetAdjList()
{
return adjList;
}
public LinkedList<int> GetWeights()
{
return weights;
}
}
}