Esempio n. 1
0
        public void FindLongPaths_WhenGraphHasNoLinks_ShouldReturnExpected()
        {
            var graph  = BuildEmptyGraph();
            var result = DiGraphHelper.FindLongPaths(graph);

            result.Should().BeEmpty();
        }
Esempio n. 2
0
        public void FindLongPaths_ShouldReturnExpected()
        {
            var graph  = BuildGraph();
            var result = DiGraphHelper.FindLongPaths(graph);

            result.Should().BeEquivalentTo((new DiNodePair("a", "c")));
        }
Esempio n. 3
0
        public void FindLongPaths_ShouldFindAllCombinations()
        {
            // This graph has two paths between a and c
            var graph = new Dgml.DirectedGraph
            {
                Nodes = new Dgml.DirectedGraphNode[]
                {
                    BuildNode("a"),
                    BuildNode("b"),
                    BuildNode("c"),
                    BuildNode("d"),
                },
                Links = new Dgml.DirectedGraphLink[]
                {
                    BuildLink("a", "b"),
                    BuildLink("b", "c"),
                    BuildLink("c", "d"),
                }
            };
            var result = DiGraphHelper.FindLongPaths(graph);

            result.Should().BeEquivalentTo(
                new DiNodePair("a", "c"),
                new DiNodePair("b", "d"),
                new DiNodePair("a", "d")
                );
        }