-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGraphWithTracking.cs
32 lines (26 loc) · 1.12 KB
/
GraphWithTracking.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
using System.Collections.Generic;
using System.Linq;
namespace ComputerNetwork.Graphs
{
public class GraphWithTracking
{
public GraphWithTracking(Graph graph)
{
_graph = graph;
IsDirected = graph.IsDirected;
NumberOfVertices = graph.NumberOfVertices;
NumberOfEdges = graph.NumberOfEdges;
IsVisited = Enumerable.Range(1, graph.NumberOfVertices).Select(_ => false).ToList();
CalculatedDistance = Enumerable.Range(1, graph.NumberOfVertices).Select(_ => double.PositiveInfinity).ToList();
}
private Graph _graph { get; }
public bool IsDirected { get; }
public int NumberOfVertices { get; }
public int NumberOfEdges { get; }
public List<bool> IsVisited { get; }
public List<double> CalculatedDistance { get; }
public List<int> Verteces => Enumerable.Range(0, NumberOfVertices).ToList();
public double this[int from, int to] => _graph[from, to];
public IEnumerable<Distance> AsEnumerable() => _graph.AsEnumerable();
}
}