public void BasicAdjacencyGraph_AddNode_Normal() { var node2 = new GraphNode <int>(1); Assert.DoesNotThrow(() => _testBasicAdjacencyGraph.AddNode(node2)); Assert.AreEqual(1, _testBasicAdjacencyGraph.GetNumberOfNodesInGraph()); }
public void BasicAdjacencyGraph_MinimumCostBetweenTwoNodes_SourceNodeHasNoNeighbours() { var a = new GraphNode <string>("A"); var b = new GraphNode <string>("B"); var c = new GraphNode <string>("C"); var d = new GraphNode <string>("D"); var e = new GraphNode <string>("E"); var stringGraph = new BasicAdjacencyGraph <string>(); stringGraph.AddNode(a); stringGraph.AddEdge(b, d, 2, 2); stringGraph.AddEdge(b, e, 2, 2); stringGraph.AddEdge(b, c, 5, 5); stringGraph.AddEdge(c, e, 5, 5); stringGraph.AddEdge(d, e, 1, 1); Assert.Throws <ConstraintException>(() => stringGraph.MinimumCostBetweenTwoNodes(a, b)); }