Example #1
0
        public cGraph(cGraphTypeEnum pGraphType = cGraphTypeEnum.directed)
        {
            this.graphType = pGraphType;
            this.verticies = new cVertex[MAX_VERTICES];
            this.adMatrix  = new int[MAX_VERTICES, MAX_VERTICES];
            numVerts       = 0;
            nTree          = 0;
            for (int j = 0; j < MAX_VERTICES; j++)
            {
                if ((pGraphType & cGraphTypeEnum.weigthed) == cGraphTypeEnum.weigthed)
                {
                    for (int k = 0; k < MAX_VERTICES; k++)
                    {
                        this.adMatrix[j, k] = infinity;
                    }
                }
                else
                {
                    for (int k = 0; k < MAX_VERTICES; k++)
                    {
                        this.adMatrix[j, k] = 0;
                    }
                }
            }

            sPath = new cDistOriginal[MAX_VERTICES];
        }
Example #2
0
        public cGraph(cGraphTypeEnum pGraphType = cGraphTypeEnum.directed)
        {
            this.graphType = pGraphType;
            this.verticies = new cVertex[MAX_VERTICES];
            this.adMatrix = new int[MAX_VERTICES, MAX_VERTICES];
            numVerts = 0;
            nTree = 0;
            for (int j = 0; j < MAX_VERTICES; j++)
            {
                if ((pGraphType & cGraphTypeEnum.weigthed) == cGraphTypeEnum.weigthed)
                {
                    for (int k = 0; k < MAX_VERTICES; k++)
                    {
                        this.adMatrix[j, k] = infinity;
                    }
                }
                else
                {
                    for (int k = 0; k < MAX_VERTICES; k++)
                    {
                        this.adMatrix[j, k] = 0;
                    }
                }

            }

            sPath = new cDistOriginal[MAX_VERTICES];
        }