2019-10-22 01:48:27 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using FluentAssertions;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using MoonTools.Core.Graph;
|
|
|
|
|
|
|
|
namespace Tests
|
|
|
|
{
|
|
|
|
public class DirectedGraphTest
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
EdgeData dummyEdgeData;
|
|
|
|
|
2019-10-22 01:48:27 +00:00
|
|
|
[Test]
|
2019-10-22 07:28:29 +00:00
|
|
|
public void AddNode()
|
2019-10-22 01:48:27 +00:00
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNode(4);
|
2019-10-22 01:48:27 +00:00
|
|
|
|
2019-10-22 07:28:29 +00:00
|
|
|
Assert.That(myGraph.Nodes, Does.Contain(4));
|
2019-10-22 01:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2019-10-22 07:28:29 +00:00
|
|
|
public void AddNodes()
|
2019-10-22 01:48:27 +00:00
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(4, 20, 69);
|
2019-10-22 01:48:27 +00:00
|
|
|
|
2019-10-22 07:28:29 +00:00
|
|
|
Assert.IsTrue(myGraph.Exists(4));
|
|
|
|
Assert.IsTrue(myGraph.Exists(20));
|
|
|
|
Assert.IsTrue(myGraph.Exists(69));
|
2019-10-22 01:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void AddEdge()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(5, 6);
|
|
|
|
myGraph.AddEdge(5, 6, dummyEdgeData);
|
2019-10-22 01:48:27 +00:00
|
|
|
|
|
|
|
Assert.That(myGraph.Neighbors(5), Does.Contain(6));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void AddEdges()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 4, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Assert.That(myGraph.Neighbors(1), Does.Contain(2));
|
|
|
|
Assert.That(myGraph.Neighbors(2), Does.Contain(3));
|
|
|
|
Assert.That(myGraph.Neighbors(2), Does.Contain(4));
|
|
|
|
Assert.That(myGraph.Neighbors(3), Does.Contain(4));
|
|
|
|
Assert.That(myGraph.Neighbors(1), Does.Not.Contain(4));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void RemoveEdge()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 4, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
myGraph.RemoveEdge(2, 3);
|
|
|
|
|
|
|
|
Assert.That(myGraph.Neighbors(2), Does.Not.Contain(3));
|
|
|
|
Assert.That(myGraph.Neighbors(2), Does.Contain(4));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2019-10-22 07:28:29 +00:00
|
|
|
public void RemoveNode()
|
2019-10-22 01:48:27 +00:00
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 4, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
2019-10-22 07:28:29 +00:00
|
|
|
myGraph.RemoveNode(2);
|
2019-10-22 01:48:27 +00:00
|
|
|
|
2019-10-22 07:28:29 +00:00
|
|
|
myGraph.Nodes.Should().NotContain(2);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.Neighbors(1).Should().NotContain(2);
|
|
|
|
myGraph.Neighbors(3).Should().Contain(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void NodeDFS()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<char, EdgeData>();
|
|
|
|
myGraph.AddNodes('a', 'b', 'c', 'd');
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
('a', 'b', dummyEdgeData),
|
|
|
|
('a', 'c', dummyEdgeData),
|
|
|
|
('b', 'd', dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = myGraph.NodeDFS();
|
|
|
|
|
|
|
|
Assert.That(result['a'][SearchSymbol.start], Is.EqualTo(1));
|
|
|
|
Assert.That(result['a'][SearchSymbol.finish], Is.EqualTo(8));
|
|
|
|
|
|
|
|
Assert.That(result['b'][SearchSymbol.start], Is.EqualTo(2));
|
|
|
|
Assert.That(result['b'][SearchSymbol.finish], Is.EqualTo(5));
|
|
|
|
|
|
|
|
Assert.That(result['c'][SearchSymbol.start], Is.EqualTo(6));
|
|
|
|
Assert.That(result['c'][SearchSymbol.finish], Is.EqualTo(7));
|
|
|
|
|
|
|
|
Assert.That(result['d'][SearchSymbol.start], Is.EqualTo(3));
|
|
|
|
Assert.That(result['d'][SearchSymbol.finish], Is.EqualTo(4));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TopologicalSortSimple()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var simpleGraph = new DirectedGraph<char, EdgeData>();
|
|
|
|
simpleGraph.AddNodes('a', 'b', 'c', 'd');
|
2019-10-22 01:48:27 +00:00
|
|
|
simpleGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
('a', 'b', dummyEdgeData),
|
|
|
|
('a', 'c', dummyEdgeData),
|
|
|
|
('b', 'a', dummyEdgeData),
|
|
|
|
('b', 'd', dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Assert.That(simpleGraph.TopologicalSort(), Is.EqualTo(new char[] { 'a', 'c', 'b', 'd' }));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TopologicalSortComplex()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var complexGraph = new DirectedGraph<char, EdgeData>();
|
|
|
|
complexGraph.AddNodes('a', 'b', 'c', 'd', 'e', 'f', 'g', 't', 'm');
|
2019-10-22 01:48:27 +00:00
|
|
|
complexGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
('a', 'b', dummyEdgeData),
|
|
|
|
('a', 'c', dummyEdgeData),
|
|
|
|
('a', 'd', dummyEdgeData),
|
|
|
|
('b', 'f', dummyEdgeData),
|
|
|
|
('b', 'g', dummyEdgeData),
|
|
|
|
('c', 'g', dummyEdgeData),
|
|
|
|
('e', 't', dummyEdgeData),
|
|
|
|
('t', 'm', dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
complexGraph.TopologicalSort(),
|
|
|
|
Is.EqualTo(new char[] { 'e', 't', 'm', 'a', 'd', 'c', 'b', 'g', 'f' })
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void StronglyConnectedComponentsSimple()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var simpleGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
simpleGraph.AddNodes(1, 2, 3);
|
2019-10-22 01:48:27 +00:00
|
|
|
simpleGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(3, 2, dummyEdgeData),
|
|
|
|
(2, 1, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = simpleGraph.StronglyConnectedComponents();
|
|
|
|
var scc = new int[] { 1, 2, 3 };
|
|
|
|
|
|
|
|
result.Should().ContainEquivalentOf(scc);
|
|
|
|
Assert.That(result.Count, Is.EqualTo(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void StronglyConnectedComponentsMedium()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var mediumGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
mediumGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
mediumGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(1, 3, dummyEdgeData),
|
|
|
|
(1, 4, dummyEdgeData),
|
|
|
|
(4, 2, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = mediumGraph.StronglyConnectedComponents();
|
|
|
|
var sccA = new int[] { 2, 3, 4 };
|
|
|
|
var sccB = new int[] { 1 };
|
|
|
|
|
|
|
|
result.Should().ContainEquivalentOf(sccA);
|
|
|
|
result.Should().ContainEquivalentOf(sccB);
|
|
|
|
Assert.That(result.Count, Is.EqualTo(2));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void StronglyConnectedComponentsComplex()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var complexGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
complexGraph.AddNodes(1, 2, 3, 4, 5, 6, 7, 8);
|
2019-10-22 01:48:27 +00:00
|
|
|
complexGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 8, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData),
|
|
|
|
(3, 7, dummyEdgeData),
|
|
|
|
(4, 5, dummyEdgeData),
|
|
|
|
(5, 3, dummyEdgeData),
|
|
|
|
(5, 6, dummyEdgeData),
|
|
|
|
(7, 4, dummyEdgeData),
|
|
|
|
(7, 6, dummyEdgeData),
|
|
|
|
(8, 1, dummyEdgeData),
|
|
|
|
(8, 7, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = complexGraph.StronglyConnectedComponents();
|
|
|
|
var sccA = new int[] { 3, 4, 5, 7 };
|
|
|
|
var sccB = new int[] { 1, 2, 8 };
|
|
|
|
var sccC = new int[] { 6 };
|
|
|
|
|
|
|
|
result.Should().ContainEquivalentOf(sccA);
|
|
|
|
result.Should().ContainEquivalentOf(sccB);
|
|
|
|
result.Should().ContainEquivalentOf(sccC);
|
|
|
|
Assert.That(result.Count, Is.EqualTo(3));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Clone()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 1, dummyEdgeData),
|
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 1, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var clone = myGraph.Clone();
|
|
|
|
Assert.That(clone, Is.Not.EqualTo(myGraph));
|
2019-10-22 07:28:29 +00:00
|
|
|
clone.Nodes.Should().BeEquivalentTo(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
clone.Neighbors(1).Should().BeEquivalentTo(1, 2);
|
|
|
|
clone.Neighbors(2).Should().BeEquivalentTo(3, 1);
|
|
|
|
clone.Neighbors(3).Should().BeEquivalentTo(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void SubGraph()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 1, dummyEdgeData),
|
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(2, 1, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var subGraph = myGraph.SubGraph(1, 2, 3);
|
2019-10-22 07:28:29 +00:00
|
|
|
subGraph.Nodes.Should().BeEquivalentTo(1, 2, 3);
|
2019-10-22 01:48:27 +00:00
|
|
|
subGraph.Neighbors(1).Should().BeEquivalentTo(1, 2);
|
|
|
|
subGraph.Neighbors(2).Should().BeEquivalentTo(1, 3);
|
|
|
|
subGraph.Neighbors(3).Should().NotContain(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void SimpleCyclesSimple()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(0, 1, 2);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(0, 0, dummyEdgeData),
|
|
|
|
(0, 1, dummyEdgeData),
|
|
|
|
(0, 2, dummyEdgeData),
|
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 0, dummyEdgeData),
|
|
|
|
(2, 1, dummyEdgeData),
|
|
|
|
(2, 2, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = myGraph.SimpleCycles();
|
|
|
|
|
|
|
|
var cycleA = new int[] { 0 };
|
|
|
|
var cycleB = new int[] { 0, 1, 2 };
|
|
|
|
var cycleC = new int[] { 0, 2 };
|
|
|
|
var cycleD = new int[] { 1, 2 };
|
|
|
|
var cycleE = new int[] { 2 };
|
|
|
|
|
|
|
|
result.Should().ContainEquivalentOf(cycleA);
|
|
|
|
result.Should().ContainEquivalentOf(cycleB);
|
|
|
|
result.Should().ContainEquivalentOf(cycleC);
|
|
|
|
result.Should().ContainEquivalentOf(cycleD);
|
|
|
|
result.Should().ContainEquivalentOf(cycleE);
|
|
|
|
result.Should().HaveCount(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void SimpleCyclesComplex()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(0, 1, dummyEdgeData),
|
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(3, 0, dummyEdgeData),
|
|
|
|
(0, 3, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData),
|
|
|
|
(4, 5, dummyEdgeData),
|
|
|
|
(5, 0, dummyEdgeData),
|
|
|
|
(1, 6, dummyEdgeData),
|
|
|
|
(6, 7, dummyEdgeData),
|
|
|
|
(7, 8, dummyEdgeData),
|
|
|
|
(8, 0, dummyEdgeData),
|
|
|
|
(8, 9, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
var result = myGraph.SimpleCycles();
|
|
|
|
var cycleA = new int[] { 0, 3 };
|
|
|
|
var cycleB = new int[] { 0, 1, 2, 3, 4, 5 };
|
|
|
|
var cycleC = new int[] { 0, 1, 2, 3 };
|
|
|
|
var cycleD = new int[] { 0, 3, 4, 5 };
|
|
|
|
var cycleE = new int[] { 0, 1, 6, 7, 8 };
|
|
|
|
|
|
|
|
result.Should().ContainEquivalentOf(cycleA);
|
|
|
|
result.Should().ContainEquivalentOf(cycleB);
|
|
|
|
result.Should().ContainEquivalentOf(cycleC);
|
|
|
|
result.Should().ContainEquivalentOf(cycleD);
|
|
|
|
result.Should().ContainEquivalentOf(cycleE);
|
|
|
|
result.Should().HaveCount(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Cyclic()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(3, 1, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Assert.That(myGraph.Cyclic(), Is.True);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Acyclic()
|
|
|
|
{
|
2019-10-22 07:28:29 +00:00
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
2019-10-22 01:48:27 +00:00
|
|
|
myGraph.AddEdges(
|
2019-10-22 07:28:29 +00:00
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
2019-10-22 01:48:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Assert.That(myGraph.Cyclic(), Is.False);
|
|
|
|
}
|
2019-10-22 07:28:29 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Clear()
|
|
|
|
{
|
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2, 3, 4);
|
|
|
|
myGraph.AddEdges(
|
|
|
|
(1, 2, dummyEdgeData),
|
|
|
|
(2, 3, dummyEdgeData),
|
|
|
|
(3, 4, dummyEdgeData)
|
|
|
|
);
|
|
|
|
|
|
|
|
myGraph.Clear();
|
|
|
|
|
|
|
|
myGraph.Nodes.Should().BeEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void EdgeExists()
|
|
|
|
{
|
|
|
|
var myGraph = new DirectedGraph<int, EdgeData>();
|
|
|
|
myGraph.AddNodes(1, 2);
|
|
|
|
myGraph.AddEdge(1, 2, dummyEdgeData);
|
|
|
|
|
|
|
|
myGraph.Exists((1, 2)).Should().BeTrue();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void EdgeData()
|
|
|
|
{
|
2019-10-23 00:46:44 +00:00
|
|
|
var myGraph = new DirectedGraph<int, NumEdgeData>();
|
2019-10-22 07:28:29 +00:00
|
|
|
myGraph.AddNodes(1, 2);
|
2019-10-23 00:46:44 +00:00
|
|
|
myGraph.AddEdge(1, 2, new NumEdgeData { testNum = 4 });
|
2019-10-22 07:28:29 +00:00
|
|
|
|
|
|
|
myGraph.EdgeData((1, 2)).testNum.Should().Be(4);
|
|
|
|
}
|
2019-10-22 01:48:27 +00:00
|
|
|
}
|
|
|
|
}
|