Example #1
0
        public void GetComponentsTest()
        {
            MarkovChain <int> chains = new MarkovChain <int>(7);

            chains.AddEdge(0, 1, 0.2);
            chains.AddEdge(0, 2, 0.7);
            chains.AddEdge(3, 2, 0.2);
            chains.AddEdge(4, 5, 0.2);


            CollectionAssert.AreEquivalent(new List <List <int> > {
                new List <int> {
                    0, 1, 2, 3
                }, new List <int> {
                    4, 5
                }, new List <int> {
                    6
                }
            }, chains.GetComponents(new List <int> {
                0, 1, 2, 3, 4, 5, 6
            }).Select(c => c.OrderBy(v => v).ToList()).ToList());
        }