capitalize enum
parent
68efeb9712
commit
4e5a5eb06b
|
@ -6,8 +6,8 @@ namespace MoonTools.Core.Graph
|
||||||
{
|
{
|
||||||
public enum SearchSymbol
|
public enum SearchSymbol
|
||||||
{
|
{
|
||||||
start,
|
Start,
|
||||||
finish
|
Finish
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DirectedGraph<TNode, TEdgeData> : IGraph<TNode, TEdgeData> where TNode : IEquatable<TNode>
|
public class DirectedGraph<TNode, TEdgeData> : IGraph<TNode, TEdgeData> where TNode : IEquatable<TNode>
|
||||||
|
@ -154,7 +154,7 @@ namespace MoonTools.Core.Graph
|
||||||
{
|
{
|
||||||
discovered.Add(v);
|
discovered.Add(v);
|
||||||
time++;
|
time++;
|
||||||
output[v].Add(SearchSymbol.start, time);
|
output[v].Add(SearchSymbol.Start, time);
|
||||||
|
|
||||||
foreach (var neighbor in Neighbors(v))
|
foreach (var neighbor in Neighbors(v))
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ namespace MoonTools.Core.Graph
|
||||||
}
|
}
|
||||||
|
|
||||||
time++;
|
time++;
|
||||||
output[v].Add(SearchSymbol.finish, time);
|
output[v].Add(SearchSymbol.Finish, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var node in Nodes)
|
foreach (var node in Nodes)
|
||||||
|
@ -190,7 +190,7 @@ namespace MoonTools.Core.Graph
|
||||||
var priority = new SortedList<uint, TNode>();
|
var priority = new SortedList<uint, TNode>();
|
||||||
foreach (var entry in dfs)
|
foreach (var entry in dfs)
|
||||||
{
|
{
|
||||||
priority.Add(entry.Value[SearchSymbol.finish], entry.Key);
|
priority.Add(entry.Value[SearchSymbol.Finish], entry.Key);
|
||||||
}
|
}
|
||||||
return priority.Values.Reverse();
|
return priority.Values.Reverse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,17 +111,17 @@ namespace Tests
|
||||||
|
|
||||||
var result = myGraph.NodeDFS();
|
var result = myGraph.NodeDFS();
|
||||||
|
|
||||||
Assert.That(result['a'][SearchSymbol.start], Is.EqualTo(1));
|
Assert.That(result['a'][SearchSymbol.Start], Is.EqualTo(1));
|
||||||
Assert.That(result['a'][SearchSymbol.finish], Is.EqualTo(8));
|
Assert.That(result['a'][SearchSymbol.Finish], Is.EqualTo(8));
|
||||||
|
|
||||||
Assert.That(result['b'][SearchSymbol.start], Is.EqualTo(2));
|
Assert.That(result['b'][SearchSymbol.Start], Is.EqualTo(2));
|
||||||
Assert.That(result['b'][SearchSymbol.finish], Is.EqualTo(5));
|
Assert.That(result['b'][SearchSymbol.Finish], Is.EqualTo(5));
|
||||||
|
|
||||||
Assert.That(result['c'][SearchSymbol.start], Is.EqualTo(6));
|
Assert.That(result['c'][SearchSymbol.Start], Is.EqualTo(6));
|
||||||
Assert.That(result['c'][SearchSymbol.finish], Is.EqualTo(7));
|
Assert.That(result['c'][SearchSymbol.Finish], Is.EqualTo(7));
|
||||||
|
|
||||||
Assert.That(result['d'][SearchSymbol.start], Is.EqualTo(3));
|
Assert.That(result['d'][SearchSymbol.Start], Is.EqualTo(3));
|
||||||
Assert.That(result['d'][SearchSymbol.finish], Is.EqualTo(4));
|
Assert.That(result['d'][SearchSymbol.Finish], Is.EqualTo(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in New Issue