internal void ParallelSchedulerTest()
        {
            ParallelScheduler ps = new ParallelScheduler();

            int[] nodes = Util.ArrayInit(5, i => ps.NewNode());
            ps.AddEdge(nodes[0], nodes[2]);
            ps.AddEdge(nodes[1], nodes[2]);
            ps.AddEdge(nodes[2], nodes[4]);
            ps.AddEdge(nodes[3], nodes[4]);
            var schedule = ps.GetScheduleWithBarriers(2);

            ParallelScheduler.WriteSchedule(schedule);
            // TODO: add assertion
        }
        public static List <List <List <int> > > ParallelSchedulerTest(int nodeCount, int parentCount)
        {
            Rand.Restart(0);
            ParallelScheduler ps = new ParallelScheduler();

            int[] nodes = Util.ArrayInit(nodeCount, i => ps.NewNode());
            for (int i = 0; i < nodeCount; i++)
            {
                if (i > parentCount)
                {
                    for (int j = 0; j < parentCount; j++)
                    {
                        int parent = Rand.Int(i);
                        if (!ps.ContainsEdge(nodes[parent], nodes[i]))
                        {
                            ps.AddEdge(nodes[parent], nodes[i]);
                        }
                    }
                }
            }
            var schedule = ps.GetScheduleWithBarriers(2);

            return(schedule);
        }