private void Escenario3() { grafo = new GrafoMatriz <int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarArista(1, 3, 2.0); grafo.AgregarArista(1, 2, 3.0); grafo.AgregarArista(2, 1, 1.0); }
private void Escenario2() { Console.WriteLine("Prueba escenario 2"); grafo = new GrafoMatriz <int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarArista(0, 2, 2.0); grafo.AgregarArista(0, 1, 3.0); }
public void TestAgregarArista() { Escenario1(); grafo.AgregarArista(0, 2, 2.0); grafo.AgregarArista(0, 1, 3.0); int esp = 2; int act = grafo.CantidadAristas(); Assert.AreEqual(esp, act); }
private void Escenario3() { grafo = new GrafoMatriz<int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarArista(1, 3, 2.0); grafo.AgregarArista(1, 2, 3.0); grafo.AgregarArista(2, 1, 1.0); }
private void Escenario2() { Console.WriteLine("Prueba escenario 2"); grafo = new GrafoMatriz<int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarArista(0, 2, 2.0); grafo.AgregarArista(0, 1, 3.0); }
public void cargarArcos(List <Arc> arcos) { Estacion[] a = Estaciones.DarVertices(); for (int i = 0; i < arcos.Count; i++) { int inicio = -1; int fin = -1; for (int j = 0; j < a.Length && inicio == -1; j++) { if (a[j].ContieneParada(arcos[i].StopIdStart)) { inicio = j; } } for (int k = 0; k < a.Length && fin == -1; k++) { if (a[k].ContieneParada(arcos[i].StopIdEnd)) { fin = k; } } try { Estaciones.AgregarArista(inicio, fin, arcos[i].ArcLenght); } catch (Exception) { } } }
private void Escenario1(){ c = new CargadoraInformacion(@"..\\..\\..\\SimulacionSistemaTransporteMasivoMio\Almacenamiento\Base de datos\"); matriz = new GrafoMatriz<Stop>(); c.AlmacenarInformacion("TRIPTYPES.txt"); c.AlmacenarInformacion("SCHEDULETYPES.txt"); c.AlmacenarInformacion("DATAPLAN.txt"); c.AlmacenarInformacion("ARCS.txt"); c.AlmacenarInformacion("CALENDAR.txt"); c.AlmacenarInformacion("LINES.txt"); c.AlmacenarInformacion("LINESARCS.txt"); c.AlmacenarInformacion("LINESTOPS.txt"); c.AlmacenarInformacion("PLANVERSIONS.txt"); c.AlmacenarInformacion("SCHEDULEPROFILES.txt"); c.AlmacenarInformacion("STOPS.txt"); c.AlmacenarInformacion("TASKS.txt"); c.AlmacenarInformacion("TRIPS.txt"); for (int i = 0; i < c.STOPS.Count; i++) { try { matriz.AgregarVertice(c.STOPS[i]); } catch (Exception) { } } for (int i = 0; i < c.ARCS.Count; i++) { int inicio = -1; int fin = -1; for (int j = 0; j < c.STOPS.Count; j++) { if (c.ARCS[i].StopIdStart == c.STOPS[j].StopId) { inicio = j; } if (c.STOPS[j].StopId == c.ARCS[i].StopIdEnd) { fin = j; } } //try //{ matriz.AgregarArista(inicio, fin, c.ARCS[i].ArcLenght); //} //catch (Exception) //{ //} } }
private void Escenario1() { c = new CargadoraInformacion(@"..\\..\\..\\SimulacionSistemaTransporteMasivoMio\Almacenamiento\Base de datos\"); matriz = new GrafoMatriz <Stop>(); c.AlmacenarInformacion("TRIPTYPES.txt"); c.AlmacenarInformacion("SCHEDULETYPES.txt"); c.AlmacenarInformacion("DATAPLAN.txt"); c.AlmacenarInformacion("ARCS.txt"); c.AlmacenarInformacion("CALENDAR.txt"); c.AlmacenarInformacion("LINES.txt"); c.AlmacenarInformacion("LINESARCS.txt"); c.AlmacenarInformacion("LINESTOPS.txt"); c.AlmacenarInformacion("PLANVERSIONS.txt"); c.AlmacenarInformacion("SCHEDULEPROFILES.txt"); c.AlmacenarInformacion("STOPS.txt"); c.AlmacenarInformacion("TASKS.txt"); c.AlmacenarInformacion("TRIPS.txt"); for (int i = 0; i < c.STOPS.Count; i++) { try { matriz.AgregarVertice(c.STOPS[i]); } catch (Exception) { } } for (int i = 0; i < c.ARCS.Count; i++) { int inicio = -1; int fin = -1; for (int j = 0; j < c.STOPS.Count; j++) { if (c.ARCS[i].StopIdStart == c.STOPS[j].StopId) { inicio = j; } if (c.STOPS[j].StopId == c.ARCS[i].StopIdEnd) { fin = j; } } //try //{ matriz.AgregarArista(inicio, fin, c.ARCS[i].ArcLenght); //} //catch (Exception) //{ //} } }
private void EscenarioMuchosVertices() { grafo = new GrafoMatriz <int>(); for (int i = 0; i < 1001; i++) { grafo.AgregarVertice(i); } for (int i = 0; i < 1000; i++) { grafo.AgregarArista(i, i + 1, 5); } }
private void EscenarioMuchosVertices() { grafo = new GrafoMatriz<int>(); for (int i = 0; i < 1001; i++) { grafo.AgregarVertice(i); } for (int i = 0; i < 1000; i++) { grafo.AgregarArista(i, i + 1, 5); } }
private void EscenarioDijkstra() { grafo = new GrafoMatriz<int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarVertice(4); grafo.AgregarVertice(5); grafo.AgregarVertice(6); grafo.AgregarVertice(7); grafo.AgregarVertice(8); grafo.AgregarVertice(9); grafo.AgregarVertice(10); grafo.AgregarVertice(11); grafo.AgregarVertice(12); grafo.AgregarVertice(13); grafo.AgregarArista(0, 1, 2.0); grafo.AgregarArista(1, 0, 2.0); grafo.AgregarArista(1, 2, 1.0); grafo.AgregarArista(2, 1, 1.0); grafo.AgregarArista(2, 3, 1.0); grafo.AgregarArista(3, 2, 1.0); grafo.AgregarArista(3, 4, 2.0); grafo.AgregarArista(4, 3, 2.0); grafo.AgregarArista(2, 5, 2.0); grafo.AgregarArista(5, 2, 2.0); grafo.AgregarArista(5, 6, 2.0); grafo.AgregarArista(6, 5, 2.0); grafo.AgregarArista(6, 7, 2.0); grafo.AgregarArista(7, 6, 2.0); grafo.AgregarArista(7, 8, 1.0); grafo.AgregarArista(8, 9, 1.0); grafo.AgregarArista(7, 11, 1.0); grafo.AgregarArista(11, 7, 1.0); grafo.AgregarArista(7, 10, 1.0); grafo.AgregarArista(10, 7, 1.0); grafo.AgregarArista(9, 10, 1.0); grafo.AgregarArista(10, 9, 1.0); grafo.AgregarArista(11, 12, 1.0); grafo.AgregarArista(12, 11, 1.0); }
private void EscenarioDijkstra() { grafo = new GrafoMatriz <int>(); grafo.AgregarVertice(1); grafo.AgregarVertice(2); grafo.AgregarVertice(3); grafo.AgregarVertice(4); grafo.AgregarVertice(5); grafo.AgregarVertice(6); grafo.AgregarVertice(7); grafo.AgregarVertice(8); grafo.AgregarVertice(9); grafo.AgregarVertice(10); grafo.AgregarVertice(11); grafo.AgregarVertice(12); grafo.AgregarVertice(13); grafo.AgregarArista(0, 1, 2.0); grafo.AgregarArista(1, 0, 2.0); grafo.AgregarArista(1, 2, 1.0); grafo.AgregarArista(2, 1, 1.0); grafo.AgregarArista(2, 3, 1.0); grafo.AgregarArista(3, 2, 1.0); grafo.AgregarArista(3, 4, 2.0); grafo.AgregarArista(4, 3, 2.0); grafo.AgregarArista(2, 5, 2.0); grafo.AgregarArista(5, 2, 2.0); grafo.AgregarArista(5, 6, 2.0); grafo.AgregarArista(6, 5, 2.0); grafo.AgregarArista(6, 7, 2.0); grafo.AgregarArista(7, 6, 2.0); grafo.AgregarArista(7, 8, 1.0); grafo.AgregarArista(8, 9, 1.0); grafo.AgregarArista(7, 11, 1.0); grafo.AgregarArista(11, 7, 1.0); grafo.AgregarArista(7, 10, 1.0); grafo.AgregarArista(10, 7, 1.0); grafo.AgregarArista(9, 10, 1.0); grafo.AgregarArista(10, 9, 1.0); grafo.AgregarArista(11, 12, 1.0); grafo.AgregarArista(12, 11, 1.0); }