- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathDistanceModel.cs
27 lines (21 loc) · 774 Bytes
/
DistanceModel.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
usingDataStructures.Graph;
namespaceAlgorithms.Graph.Dijkstra;
/// <summary>
/// Entity which represents the Dijkstra shortest distance.
/// Contains: Vertex, Previous Vertex and minimal distance from start vertex.
/// </summary>
/// <typeparam name="T">Generic parameter.</typeparam>
publicclassDistanceModel<T>
{
publicVertex<T>?Vertex{get;}
publicVertex<T>?PreviousVertex{get;set;}
publicdoubleDistance{get;set;}
publicDistanceModel(Vertex<T>?vertex,Vertex<T>?previousVertex,doubledistance)
{
Vertex=vertex;
PreviousVertex=previousVertex;
Distance=distance;
}
publicoverridestringToString()=>
$"Vertex: {Vertex} - Distance: {Distance} - Previous: {PreviousVertex}";
}