public void EqualGraphTest() { var otherGraph = new AdjacencyListGraph(); var lv2complete = new AdjacencyListGraph(m_level2pos); lv2complete.MakeComplete(); Assert.True(m_complete4.Equals(m_complete4)); Assert.False(otherGraph.Equals(m_complete4)); // Graph on the same vertices Assert.False(lv2complete.Equals(otherGraph)); //Same graphs on different vertex set Assert.True(lv2complete.Equals(lv2complete)); }
public void Level2MSTTest() { var level2mst = MST.MinimumSpanningTree(m_level2pos); var expected = new AdjacencyListGraph(m_level2pos); var level2vertices = expected.Vertices.ToList(); for (int i = 0; i < level2vertices.Count - 1; i++) { expected.AddEdge(level2vertices[i], level2vertices[i + 1]); } Assert.True(expected.Equals(level2mst)); }
public void GreedySpannerLineGraphTest() { //Line graph test case var vert = new List <Vertex> { new Vertex(0, 0), new Vertex(1, 0), new Vertex(2, 0) }; var lineGraph = new AdjacencyListGraph(vert); lineGraph.AddEdge(vert[0], vert[1]); lineGraph.AddEdge(vert[1], vert[2]); var spanner = Spanner.GreedySpanner(vert, 20); Assert.True(lineGraph.Equals(spanner)); }
public void GreedySpannerCompleteTest() { Assert.True(m_complete4.Equals(Spanner.GreedySpanner(m_complete4pos, 1))); //large test case var pos = new List <Vertex> { new Vertex(9, 3), new Vertex(5, 6), new Vertex(4, 7), new Vertex(-2, 5), new Vertex(6, -3), new Vertex(23, 3), new Vertex(22, 4), new Vertex(9.5f, -3.4f), new Vertex(5.5f, -6.3f), new Vertex(-4.5f, 7.4f), new Vertex(-2.5f, -5.3f), new Vertex(6.5f, -3.3f), new Vertex(23.5f, -4.3f), new Vertex(22.5f, -5.3f) }; var completegraph = new AdjacencyListGraph(pos); completegraph.MakeComplete(); var spanner = Spanner.GreedySpanner(pos, 1); Assert.True(completegraph.Equals(spanner)); }