public void TestMethod1() { List <List <int> > Vertex = new List <List <int> >(); Vertex.Add(new List <int> { 0, 1, 1, 1, 0 }); Vertex.Add(new List <int> { 1, 0, 1, 0, 0 }); Vertex.Add(new List <int> { 1, 1, 0, 1, 0 }); Vertex.Add(new List <int> { 1, 0, 1, 0, 1 }); Vertex.Add(new List <int> { 0, 0, 0, 1, 0 }); BacktrakingTriple VC = new BacktrakingTriple(Vertex); int ans = 3; var DebeDar = VC.vertexC(); Assert.AreEqual(ans, DebeDar); }
public int preprocesar() { int posj = 0; for (int i = 0; i < nro_nodos; ++i) { int nro_vecinos = 0; for (int j = 0; j < nro_nodos; ++j) { if (grafo[i][j] == 1) { nro_vecinos++; posj = j; if (nro_vecinos > 1) { break; } } } if (nro_vecinos == 1) { asignacion[posj] = 1; grafo2[i][posj] = 0; grafo2[posj][i] = 0; } } Grafo g = new Grafo(grafo2); BacktrakingTriple VC = new BacktrakingTriple(g); VC.setAsignacion(asignacion); int ans = VC.vertexC(); return(ans); }
public ActionResult VCBacktrTrios(string json) { Grafo grafo = new JavaScriptSerializer().Deserialize <Grafo>(json); BacktrakingTriple Vc = new BacktrakingTriple(grafo); int answ = Vc.vertexC(); return(Json(answ, JsonRequestBehavior.AllowGet)); }