Esempio n. 1
0
  @Test
  public void testC2() {

    Investigador esteban = new Investigador("esteban");
    Investigador irene = new Investigador("irene");
    Investigador alejandro = new Investigador("alejandro");
    Investigador paula = new Investigador("paula");
    esteban.AgregarAmigo(alejandro);
    irene.AgregarAmigo(alejandro);
    paula.AgregarAmigo(alejandro);

    alejandro.dameAmigos();
    irene.dameAmigos();
    paula.dameAmigos();
    esteban.dameAmigos();

    ArrayList<Investigador> investigadoresLocos = new ArrayList<Investigador>();
    investigadoresLocos.add(irene);
    investigadoresLocos.add(alejandro);
    investigadoresLocos.add(esteban);
    investigadoresLocos.add(paula);

    Relaciones prueba = new Relaciones(investigadoresLocos, esteban, irene);
    int res = prueba.BFS(esteban, irene);
    System.out.println("la distancia entre esteban e irene es " + res);

    assertEquals(2, res);
  }
Esempio n. 2
0
  @Test
  public void testC7() {
    Investigador esteban = new Investigador("esteban");
    Investigador irene = new Investigador("irene");
    Investigador alejandro = new Investigador("alejandro");
    Investigador paula = new Investigador("paula");
    Investigador emilio = new Investigador("emilio");
    Investigador marina = new Investigador("marina");

    irene.AgregarAmigo(alejandro);
    irene.AgregarAmigo(paula);
    paula.AgregarAmigo(emilio);
    emilio.AgregarAmigo(esteban);
    emilio.AgregarAmigo(marina);
    alejandro.AgregarAmigo(marina);

    irene.dameAmigos();
    emilio.dameAmigos();
    marina.dameAmigos();
    alejandro.dameAmigos();

    ArrayList<Investigador> investigadores = new ArrayList<Investigador>();
    investigadores.add(esteban);
    investigadores.add(irene);
    investigadores.add(alejandro);
    investigadores.add(paula);
    investigadores.add(emilio);
    investigadores.add(marina);

    Relaciones relacion = new Relaciones(investigadores, esteban, irene);
    int res = relacion.BFS(esteban, irene);
    System.out.println("El resultado es " + res);

    assertEquals(3, res);
  }
Esempio n. 3
0
  @Test
  public void testC1() {
    Investigador esteban = new Investigador("esteban");
    Investigador irene = new Investigador("irene");

    ArrayList<Investigador> investigadores = new ArrayList<Investigador>();
    investigadores.add(esteban);
    investigadores.add(irene);

    Relaciones relacion = new Relaciones(investigadores, esteban, irene);
    int res = relacion.BFS(esteban, irene);
    System.out.println("El resultado es " + res);

    assertEquals(0, res);
  }
Esempio n. 4
0
  @Test
  public void testLineal() {
    Investigador esteban = new Investigador("esteban");
    Investigador alejandro = new Investigador("alejandro");
    Investigador paula = new Investigador("paula");
    Investigador emilio = new Investigador("emilio");
    Investigador marina = new Investigador("marina");
    Investigador santiago = new Investigador("santiago");
    Investigador mauro = new Investigador("mauro");
    Investigador lucas = new Investigador("lucas");
    Investigador juanma = new Investigador("juanma");
    Investigador irene = new Investigador("irene");

    esteban.AgregarAmigo(alejandro);
    alejandro.AgregarAmigo(paula);
    paula.AgregarAmigo(emilio);
    emilio.AgregarAmigo(marina);
    marina.AgregarAmigo(santiago);
    santiago.AgregarAmigo(mauro);
    mauro.AgregarAmigo(lucas);
    lucas.AgregarAmigo(juanma);
    juanma.AgregarAmigo(irene);

    ArrayList<Investigador> investigadores = new ArrayList<Investigador>();
    investigadores.add(esteban);
    investigadores.add(alejandro);
    investigadores.add(paula);
    investigadores.add(emilio);
    investigadores.add(marina);
    investigadores.add(santiago);
    investigadores.add(mauro);
    investigadores.add(lucas);
    investigadores.add(juanma);
    investigadores.add(irene);

    Relaciones relacion = new Relaciones(investigadores, esteban, irene);
    int res = relacion.BFS(esteban, irene);
    System.out.println("El resultado es " + res);

    assertEquals(9, res);
  }