public void should_get_correct_count() { var graph = new DAG <int>(); Assert.Equal(graph.Out().Count(), 0); graph.Add(0); Assert.Equal(graph.Out().Count(), 1); }
public void should_get_vertexes_for_simple_direct() { var graph = new DAG <int>(); const int from = 0; const int to = 1; graph.Add(from); graph.AddPath(from, to); var items = graph.Out(); Assert.Equal(2, items.Length); Assert.Equal(to, items[0]); Assert.Equal(from, items[1]); }
public void should_get_sub_vertexes_for_one() { var graph = new DAG <int>(); const int from = 0; const int to = 1; graph.Add(from); graph.AddPath(from, to); var subOfTo = graph.GetSubOf(to); Assert.Equal(0, subOfTo.Length); var subOfFrom = graph.GetSubOf(from); Assert.Equal(1, subOfFrom.Length); Assert.Equal(to, subOfFrom[0]); }