예제 #1
0
        public void Test_ReadWrite()
        {
            ClusterTree rt1  = new ClusterTree();
            RangeNode   root = new RangeNode(5);

            rt1.Root = root;
            for (int i = 0; i < 5; ++i)
            {
                root.Children[i] = new RangeNode(0)
                {
                    UpperLimit = 0.1f * i
                };
            }
            rt1.Version.UserDescription = "Bla bla";

            string fileName = Path.Combine(_outDir, "ClusterTree.dat");

            rt1.Write(fileName);
            ClusterTree rt2 = ClusterTree.Read(fileName);

            Assert.AreEqual(rt1.Version, rt2.Version);
            Assert.IsTrue(CompareTrees <int, int> .Compare(rt1, rt1.Root, rt2, rt2.Root,
                                                           (t1, n1, t2, n2) =>
            {
                return(((RangeNode)n1).UpperLimit == ((RangeNode)n2).UpperLimit);
            }));
        }
예제 #2
0
        private static void Visualize(string rtFile)
        {
            ClusterTree rt       = ClusterTree.Read(rtFile);
            string      fileName = rtFile + ".gv";

            using (TextWriter output = new StreamWriter(fileName))
            {
                var vis = new ClusterTree.Vis
                {
                    Output       = output,
                    ShowDealPath = _cmdLine.ShowPath
                };
                vis.Walk(rt, rt.Root);
            }
        }