Ejemplo n.º 1
0
        public void run()
        {
            MGraph pMGraph = new MGraph();
            pMGraph.init(3, 3, 1, 1);

            List<Vertex> vertList;
            FileStream pFile = new FileStream("E:\\aaa.txt", FileMode.Create);
            string strStream = "";

            vertList = test5Stop(pMGraph);
            serializePath(vertList, ref strStream);
            pMGraph.clearAllStopPoint();
            pMGraph.clearPath();

            vertList = test4Stop(pMGraph);
            serializePath(vertList, ref strStream);
            pMGraph.clearAllStopPoint();
            pMGraph.clearPath();

            vertList = test2Stop(pMGraph);
            serializePath(vertList, ref strStream);
            pMGraph.clearAllStopPoint();
            pMGraph.clearPath();

            vertList = test2Stop(pMGraph);
            serializePath(vertList, ref strStream);
            pMGraph.clearAllStopPoint();
            pMGraph.clearPath();

            byte[] inBytes = System.Text.Encoding.UTF8.GetBytes(strStream);
            pFile.Write(inBytes, 0, inBytes.Length);
            pFile.Close();
            pFile.Dispose();
        }
Ejemplo n.º 2
0
        // ²âÊÔ 0 ¸ö×èµ²µã
        public List<Vertex> test0Stop(MGraph pMGraph)
        {
            List<Vertex> vertList;
            if (pMGraph.isPathCacheValid(0, 4))
            {
                vertList = pMGraph.getShortestPathFromPathCache(0, 4);
            }
            else
            {
                vertList = pMGraph.getOrCreateShortestPath(0, 4);
            }

            return vertList;
        }
Ejemplo n.º 3
0
        // ²âÊÔ 1 ¸ö×èµ²µã
        public List<Vertex> test1Stop(MGraph pMGraph)
        {
            StopPoint pStopPoint = null;

            pStopPoint = new StopPoint();
            pMGraph.addStopPoint(1, 0, pStopPoint);

            List<Vertex> vertList;
            if (pMGraph.isPathCacheValid(0, 8))
            {
                vertList = pMGraph.getShortestPathFromPathCache(0, 8);
            }
            else
            {
                vertList = pMGraph.getOrCreateShortestPath(0, 8);
            }

            return vertList;
        }