示例#1
0
        public GrafoMatriz grafoTransposto()
        {
            GrafoMatriz grafoT = new GrafoMatriz(this.numVertices);

            for (int v = 0; v < this.numVertices; v++)
            {
                if (!this.listaAdjVazia(v))
                {
                    Aresta adj = this.primeiroListaAdj(v);
                    while (adj != null)
                    {
                        grafoT.insereAresta(adj.v2, adj.v1, adj.peso);
                        adj = this.proxAdj(v);
                    }
                }
            }

            return(grafoT);
        }