コード例 #1
0
ファイル: Grafo.cs プロジェクト: Yurinabaia/AtividadeGrafo
        public bool isConexo()
        {
			
			Grafoc G = new Grafoc(NumeroV);
			GrafoM solucao = new GrafoM(G);
			solucao.buscaProfundidade();
			if (solucao.componentes == 1)
				return true;
			else
				return false;
			
		}
コード例 #2
0
ファイル: Grafo.cs プロジェクト: Yurinabaia/AtividadeGrafo
		public int getCutVertices() 
		{
			int contageCutV = 0;
				

			List<string>[] grafoclonado = new List<string>[20];

			for (int j = 2; j < NumeroV; j++)
			{
				if(j == 6)
				{

				}

				for (int i = 0; i < NumeroVerticesNaoDirigido; i++)
					grafoclonado[i] = new List<string>();

				for (int i = 0; i < NumeroVerticesNaoDirigido; i++)
					verticesV[i] = new List<int>();

				DeletarV(grafoclonado, j);

				int a = 0;

				Console.WriteLine("Grafo não dirigido \n\n\n");
				foreach (var item in grafoclonado)
				{
					if (a < NumeroVerticesNaoDirigido)
					{
						foreach (var s in grafoclonado[a])
						{
							string[] splitando = s.Split(" ");
							Console.WriteLine(a + " ------- " + s);
							verticesV[a - 1].Add(int.Parse(splitando[0].Trim()) - 1);
							Console.WriteLine(splitando[0] + " ---------- " + a + " " + splitando[1] + " " + splitando[2] + " " + splitando[3]);
							if (maior < a)
								maior = a;
							if (maior < int.Parse(splitando[0].Trim()))
								maior = int.Parse(splitando[0].Trim());
						}
						a++;
					}
				}
				GrafoM solucao = new GrafoM(this);
				solucao.buscaProfundidadeV();
				if (solucao.componentes != 1)
					contageCutV++;
			}
			return contageCutV;
		}