monorepo
This commit is contained in:
20
PI1/.classpath
Normal file
20
PI1/.classpath
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="adda/ejemplos" kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-20">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/DatosCompartidos">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/ParteComun">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
PI1/.project
Normal file
17
PI1/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PI1</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
2
PI1/.settings/org.eclipse.core.resources.prefs
Normal file
2
PI1/.settings/org.eclipse.core.resources.prefs
Normal file
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
15
PI1/.settings/org.eclipse.jdt.core.prefs
Normal file
15
PI1/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=20
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=20
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=20
|
||||
6
PI1/data/PI1Ej1DatosEntrada.txt
Normal file
6
PI1/data/PI1Ej1DatosEntrada.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
32,55
|
||||
15,140
|
||||
82,120
|
||||
26,89
|
||||
35,54
|
||||
3,126
|
||||
6
PI1/data/PI1Ej2DatosEntrada.txt
Normal file
6
PI1/data/PI1Ej2DatosEntrada.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
93,24
|
||||
250,43
|
||||
331,473
|
||||
210,56
|
||||
345,68
|
||||
75,5009
|
||||
14
PI1/data/PI1Ej3DatosEntrada1A.txt
Normal file
14
PI1/data/PI1Ej3DatosEntrada1A.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Apple
|
||||
Banana
|
||||
Cherries
|
||||
Grapes
|
||||
Lemon
|
||||
Orange
|
||||
Peach
|
||||
Pear
|
||||
Pineapple
|
||||
Plum
|
||||
Pomegranate
|
||||
Strawberry
|
||||
Apricot
|
||||
Blueberries
|
||||
10
PI1/data/PI1Ej3DatosEntrada1B.txt
Normal file
10
PI1/data/PI1Ej3DatosEntrada1B.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Dolphin
|
||||
Fish
|
||||
Cat
|
||||
Crab
|
||||
Pig
|
||||
Elephant
|
||||
Butterfly
|
||||
Whale
|
||||
Dog
|
||||
Chicken
|
||||
12
PI1/data/PI1Ej3DatosEntrada2A.txt
Normal file
12
PI1/data/PI1Ej3DatosEntrada2A.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Red
|
||||
Blue
|
||||
Green
|
||||
Yellow
|
||||
Purple
|
||||
Orange
|
||||
Pink
|
||||
Brown
|
||||
Black
|
||||
White
|
||||
Gray
|
||||
Silver
|
||||
17
PI1/data/PI1Ej3DatosEntrada2B.txt
Normal file
17
PI1/data/PI1Ej3DatosEntrada2B.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
Carrot
|
||||
Broccoli
|
||||
Cauliflower
|
||||
Tomato
|
||||
Cucumber
|
||||
Spinach
|
||||
Lettuce
|
||||
Potato
|
||||
Onion
|
||||
Garlic
|
||||
Peas
|
||||
Beans
|
||||
Asparagus
|
||||
Zucchini
|
||||
Eggplant
|
||||
Celery
|
||||
Radish
|
||||
23
PI1/data/PI1Ej3DatosEntrada3A.txt
Normal file
23
PI1/data/PI1Ej3DatosEntrada3A.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
Jeans
|
||||
Jacket
|
||||
Dress
|
||||
Sweater
|
||||
Skirt
|
||||
Pants
|
||||
Blouse
|
||||
Shorts
|
||||
Socks
|
||||
Hat
|
||||
Coat
|
||||
Gloves
|
||||
Scarf
|
||||
Underwear
|
||||
Belt
|
||||
Boots
|
||||
Sneakers
|
||||
Sandals
|
||||
Blazer
|
||||
Pajamas
|
||||
Hoodie
|
||||
Vest
|
||||
Tights
|
||||
18
PI1/data/PI1Ej3DatosEntrada3B.txt
Normal file
18
PI1/data/PI1Ej3DatosEntrada3B.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
Doctor
|
||||
Teacher
|
||||
Engineer
|
||||
Lawyer
|
||||
Nurse
|
||||
Scientist
|
||||
Artist
|
||||
Chef
|
||||
Firefighter
|
||||
Police officer
|
||||
Dentist
|
||||
Architect
|
||||
Musician
|
||||
Actor
|
||||
Accountant
|
||||
Electrician
|
||||
Writer
|
||||
Farmer
|
||||
6
PI1/data/PI1Ej4DatosEntrada.txt
Normal file
6
PI1/data/PI1Ej4DatosEntrada.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
10,6
|
||||
9,11
|
||||
16,7
|
||||
21,5
|
||||
8,10
|
||||
22,12
|
||||
57
PI1/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
57
PI1/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import adda.util.EnteroCadena;
|
||||
|
||||
public class Ejercicio1 {
|
||||
public static String ej1Func(Integer varA, Integer varB) {
|
||||
UnaryOperator<EnteroCadena> nx = elem -> {
|
||||
return EnteroCadena.of(elem.a() + 3,
|
||||
elem.a() % 2 == 0 ? elem.a() + "*" : elem.a() + "!");
|
||||
};
|
||||
|
||||
return Stream.iterate(EnteroCadena.of(varA, "A"), elem -> elem.a() < varB, nx)
|
||||
.filter(elem -> elem.a() % 10 != 0)
|
||||
.map(elem -> elem.s())
|
||||
.collect(Collectors.joining("-"));
|
||||
}
|
||||
|
||||
public static String ej1Iter(Integer varA, Integer varB) {
|
||||
EnteroCadena seed = EnteroCadena.of(varA, "A");
|
||||
StringBuilder res = new StringBuilder();
|
||||
int ac = varA;
|
||||
res.append(seed.s());
|
||||
while(ac < varB) {
|
||||
EnteroCadena ec = EnteroCadena.of(ac+3, ac % 2 == 0 ? ac + "*" : ac + "!");
|
||||
if(ec.a() % 10 != 0 && ec.a() < varB) {
|
||||
res.append("-").append(ec.s());
|
||||
}
|
||||
ac+=3;
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
public static String ej1RecF(Integer varA, Integer varB) {
|
||||
EnteroCadena seed = EnteroCadena.of(varA, "A");
|
||||
StringBuilder res = new StringBuilder();
|
||||
int ac = varA;
|
||||
res.append(seed.s());
|
||||
return ej1RecFAux(varA, varB, res, ac);
|
||||
}
|
||||
|
||||
public static String ej1RecFAux(Integer varA, Integer varB, StringBuilder res, Integer ac) {
|
||||
if(ac < varB) {
|
||||
EnteroCadena ec = EnteroCadena.of(ac+3, ac % 2 == 0 ? ac + "*" : ac + "!");
|
||||
if(ec.a() % 10 != 0 && ec.a() < varB) {
|
||||
res.append("-").append(ec.s());
|
||||
}
|
||||
ac+=3;
|
||||
return ej1RecFAux(varA, varB, res, ac);
|
||||
} else {
|
||||
return res.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
83
PI1/src/main/java/adda/ejercicios/Ejercicio2.java
Normal file
83
PI1/src/main/java/adda/ejercicios/Ejercicio2.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import adda.util.TuplaEjercicio2;
|
||||
|
||||
public class Ejercicio2 {
|
||||
public static List<Integer> ejercicio2RecNF(Integer a, Integer b) {
|
||||
List<Integer> ls = new ArrayList<>();
|
||||
if(a < 2 || b < 2) {
|
||||
return List.of(a*b);
|
||||
} else if(a > b) {
|
||||
ls.addAll(ejercicio2RecNF(a%b, b-1));
|
||||
ls.add(a);
|
||||
} else {
|
||||
ls.addAll(ejercicio2RecNF(a-2, b/2));
|
||||
ls.add(b);
|
||||
}
|
||||
return ls;
|
||||
}
|
||||
|
||||
public static List<Integer> ejercicio2RecF(Integer a, Integer b) {
|
||||
List<Integer> ls = new ArrayList<>();
|
||||
return ejercicio2RecFAux(a, b, ls);
|
||||
}
|
||||
|
||||
public static List<Integer> ejercicio2RecFAux(Integer a, Integer b, List<Integer> ls) {
|
||||
if (a < 2 || b < 2) {
|
||||
ls.add(a * b);
|
||||
} else if (a > b) {
|
||||
ls.addAll(ejercicio2RecFAux(a % b, b - 1, new ArrayList<>()));
|
||||
ls.add(a);
|
||||
} else {
|
||||
ls.addAll(ejercicio2RecFAux(a - 2, b / 2, new ArrayList<>()));
|
||||
ls.add(b);
|
||||
}
|
||||
return ls;
|
||||
}
|
||||
|
||||
public static List<Integer> ejercicio2Iter(Integer a, Integer b) {
|
||||
List<Integer> ls = new ArrayList<>();
|
||||
while (a >= 2 && b >= 2) {
|
||||
if (a > b) {
|
||||
ls.add(a);
|
||||
a %= b;
|
||||
b--;
|
||||
} else {
|
||||
ls.add(b);
|
||||
b /= 2;
|
||||
a -= 2;
|
||||
}
|
||||
}
|
||||
ls.add(a * b);
|
||||
Collections.reverse(ls);
|
||||
return ls;
|
||||
}
|
||||
|
||||
public static List<Integer> ejercicio2Func(Integer a, Integer b) {
|
||||
UnaryOperator<TuplaEjercicio2> next = x -> {
|
||||
if(x.a() < 2 || x.b() < 2) {
|
||||
x.ac().add(x.a()*x.b());
|
||||
return TuplaEjercicio2.of(0, 0, x.ac());
|
||||
} else if (x.a() > x.b()) {
|
||||
x.ac().add(x.a());
|
||||
return TuplaEjercicio2.of(x.a() % x.b(), x.b() - 1, x.ac());
|
||||
} else {
|
||||
x.ac().add(x.b());
|
||||
return TuplaEjercicio2.of(x.a() - 2, x.b() / 2, x.ac());
|
||||
}
|
||||
};
|
||||
List<Integer> res = Stream.iterate(
|
||||
TuplaEjercicio2.of(a, b, new ArrayList<Integer>()),
|
||||
x -> x.hasNext(),
|
||||
x -> next.apply(x)).toList().get(0).ac();
|
||||
Collections.sort(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
74
PI1/src/main/java/adda/ejercicios/Ejercicio3.java
Normal file
74
PI1/src/main/java/adda/ejercicios/Ejercicio3.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import adda.util.TuplaEjercicio3;
|
||||
import us.lsi.streams.Stream2;
|
||||
|
||||
public class Ejercicio3 {
|
||||
public static List<String> ejercicio3Iter(String fichA, String fichB) {
|
||||
List<String> ac = new ArrayList<>();
|
||||
Iterator<String> iterA = Stream2.file(fichA).iterator();
|
||||
Iterator<String> iterB = Stream2.file(fichB).iterator();
|
||||
while(iterA.hasNext() || iterB.hasNext()) {
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
}
|
||||
}
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ac;
|
||||
}
|
||||
|
||||
public static List<String> ejercicio3RecF(String fichA, String fichB) {
|
||||
List<String> ac = new ArrayList<>();
|
||||
Iterator<String> iterA = Stream2.file(fichA).iterator();
|
||||
Iterator<String> iterB = Stream2.file(fichB).iterator();
|
||||
return ejercicio3RecFAux(fichA, fichB, iterA, iterB, ac);
|
||||
}
|
||||
|
||||
public static List<String> ejercicio3RecFAux(String fichA, String fichB,
|
||||
Iterator<String> iterA, Iterator<String> iterB, List<String> ac) {
|
||||
List<String> res = new ArrayList<>();
|
||||
if(iterA.hasNext() || iterB.hasNext()) {
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
}
|
||||
}
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
}
|
||||
}
|
||||
res = ejercicio3RecFAux(fichA, fichB, iterA, iterB, ac);
|
||||
} else {
|
||||
res = ac;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static List<String> ejercicio3Func(String fichA, String fichB) {
|
||||
return Stream.iterate(TuplaEjercicio3.of(
|
||||
Stream2.file(fichA).iterator(),
|
||||
Stream2.file(fichB).iterator(),
|
||||
new ArrayList<>()),
|
||||
x -> x.next())
|
||||
.filter(x -> !x.hasNext())
|
||||
.findFirst()
|
||||
.get()
|
||||
.ac();
|
||||
}
|
||||
}
|
||||
66
PI1/src/main/java/adda/ejercicios/Ejercicio4.java
Normal file
66
PI1/src/main/java/adda/ejercicios/Ejercicio4.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import us.lsi.common.Pair;
|
||||
|
||||
public class Ejercicio4 {
|
||||
public static String ejercicio4RecSinMem(Integer a, Integer b) {
|
||||
if(a <= 4) {
|
||||
return a+"."+b;
|
||||
} else if(b <= 4) {
|
||||
return b+"-"+a;
|
||||
} else {
|
||||
return ejercicio4RecSinMem(a/2, b-2)+","+ejercicio4RecSinMem(a-2, b/2)+","+ejercicio4RecSinMem(a-1, b-1);
|
||||
}
|
||||
}
|
||||
|
||||
public static String ejercicio4RecConMem(Integer a, Integer b) {
|
||||
return ejercicio4RecConMemAux(a,b,new HashMap<>());
|
||||
}
|
||||
|
||||
public static String ejercicio4RecConMemAux(Integer a, Integer b, Map<Pair<Integer,Integer>,String> map) {
|
||||
Pair<Integer,Integer> pair = Pair.of(a, b);
|
||||
String res = null;
|
||||
if(map.containsKey(pair)) {
|
||||
return map.get(pair);
|
||||
} else {
|
||||
if(a <= 4) {
|
||||
res = a+"."+b;
|
||||
map.put(pair, res);
|
||||
} else if(b <= 4) {
|
||||
res = b+"-"+a;
|
||||
map.put(pair, res);
|
||||
} else {
|
||||
res = ejercicio4RecConMemAux(a/2, b-2,map)+","+ejercicio4RecConMemAux(a-2, b/2,map)+","+ejercicio4RecConMemAux(a-1, b-1,map);
|
||||
map.put(pair, res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String ejercicio4Iter(Integer a, Integer b) {
|
||||
Map<Pair<Integer,Integer>, String> map = new HashMap<>();
|
||||
for(int i = 0; i <= a; i++) {
|
||||
for(int j = 0; j <= b; j++) {
|
||||
Pair<Integer,Integer> pair = Pair.of(i, j);
|
||||
String res = null;
|
||||
if(map.containsKey(pair)) {
|
||||
return map.get(pair);
|
||||
}
|
||||
if(i <= 4) {
|
||||
res = i+"."+j;
|
||||
map.put(pair, res);
|
||||
} else if(j <= 4) {
|
||||
res = j+"-"+i;
|
||||
map.put(pair, res);
|
||||
} else {
|
||||
res = map.get(Pair.of(i/2, j-2))+","+map.get(Pair.of(i-2, j/2))+","+map.get(Pair.of(i-1, j-1));
|
||||
map.put(pair, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map.get(Pair.of(a, b));
|
||||
}
|
||||
}
|
||||
128
PI1/src/main/java/adda/tests/Tests.java
Normal file
128
PI1/src/main/java/adda/tests/Tests.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package adda.tests;
|
||||
|
||||
import adda.ejercicios.Ejercicio1;
|
||||
import adda.ejercicios.Ejercicio2;
|
||||
import adda.ejercicios.Ejercicio3;
|
||||
import adda.ejercicios.Ejercicio4;
|
||||
import us.lsi.common.Files2;
|
||||
|
||||
public class Tests {
|
||||
public static void testEjercicio1 () {
|
||||
System.out.println("================ EJERCICIO 1 ================");
|
||||
StringBuilder sbFun = new StringBuilder("Funcional: \n");
|
||||
StringBuilder sbIter = new StringBuilder("Iterativo: \n");
|
||||
StringBuilder sbRecF = new StringBuilder("Recursivo Final: \n");
|
||||
for(String linea: Files2.linesFromFile("data/PI1Ej1DatosEntrada.txt")) {
|
||||
String[] partes = linea.split(",");
|
||||
Integer a = Integer.valueOf(partes[0]);
|
||||
Integer b = Integer.valueOf(partes[1]);
|
||||
sbFun.append(Ejercicio1.ej1Func(a, b));
|
||||
sbFun.append("\n");
|
||||
sbIter.append(Ejercicio1.ej1Iter(a, b));
|
||||
sbIter.append("\n");
|
||||
sbRecF.append(Ejercicio1.ej1RecF(a, b));
|
||||
sbRecF.append("\n");
|
||||
}
|
||||
System.out.println(sbFun.toString());
|
||||
System.out.println(sbIter.toString());
|
||||
System.out.println(sbRecF.toString());
|
||||
System.out.println("=============================================");
|
||||
System.out.println("\n\n");
|
||||
}
|
||||
|
||||
public static void testEjercicio2 () {
|
||||
System.out.println("================ EJERCICIO 2 ================");
|
||||
StringBuilder sbFun = new StringBuilder("Funcional: \n");
|
||||
StringBuilder sbIter = new StringBuilder("Iterativo: \n");
|
||||
StringBuilder sbRecF = new StringBuilder("Recursivo Final: \n");
|
||||
StringBuilder sbRecNF = new StringBuilder("Recursivo No Final: \n");
|
||||
|
||||
for(String linea: Files2.linesFromFile("data/PI1Ej2DatosEntrada.txt")) {
|
||||
String[] partes = linea.split(",");
|
||||
Integer a = Integer.valueOf(partes[0]);
|
||||
Integer b = Integer.valueOf(partes[1]);
|
||||
|
||||
sbFun.append(Ejercicio2.ejercicio2Func(a, b));
|
||||
sbFun.append("\n");
|
||||
|
||||
sbIter.append(Ejercicio2.ejercicio2Iter(a, b));
|
||||
sbIter.append("\n");
|
||||
|
||||
sbRecF.append(Ejercicio2.ejercicio2RecF(a, b));
|
||||
sbRecF.append("\n");
|
||||
|
||||
sbRecNF.append(Ejercicio2.ejercicio2RecNF(a, b));
|
||||
sbRecNF.append("\n");
|
||||
}
|
||||
|
||||
System.out.println(sbFun.toString());
|
||||
System.out.println(sbIter.toString());
|
||||
System.out.println(sbRecF.toString());
|
||||
System.out.println(sbRecNF.toString());
|
||||
System.out.println("=============================================");
|
||||
System.out.println("\n\n");
|
||||
}
|
||||
|
||||
public static void testEjercicio3 () {
|
||||
String file1A = "./data/PI1Ej3DatosEntrada1A.txt";
|
||||
String file1B = "./data/PI1Ej3DatosEntrada1B.txt";
|
||||
String file2A = "./data/PI1Ej3DatosEntrada2A.txt";
|
||||
String file2B = "./data/PI1Ej3DatosEntrada2B.txt";
|
||||
String file3A = "./data/PI1Ej3DatosEntrada3A.txt";
|
||||
String file3B = "./data/PI1Ej3DatosEntrada3B.txt";
|
||||
|
||||
System.out.println("================ EJERCICIO 3 ================");
|
||||
System.out.println("Iterativo: ");
|
||||
System.out.println(Ejercicio3.ejercicio3Iter(file1A, file1B));
|
||||
System.out.println(Ejercicio3.ejercicio3Iter(file2A, file2B));
|
||||
System.out.println(Ejercicio3.ejercicio3Iter(file3A, file3B));
|
||||
System.out.println("\n");
|
||||
System.out.println("Recursivo Final: ");
|
||||
System.out.println(Ejercicio3.ejercicio3RecF(file1A, file1B));
|
||||
System.out.println(Ejercicio3.ejercicio3RecF(file2A, file2B));
|
||||
System.out.println(Ejercicio3.ejercicio3RecF(file3A, file3B));
|
||||
System.out.println("\n");
|
||||
System.out.println("Funcional: ");
|
||||
System.out.println(Ejercicio3.ejercicio3Func(file1A, file1B));
|
||||
System.out.println(Ejercicio3.ejercicio3Func(file2A, file2B));
|
||||
System.out.println(Ejercicio3.ejercicio3Func(file3A, file3B));
|
||||
System.out.println("=============================================");
|
||||
System.out.println("\n\n");
|
||||
}
|
||||
|
||||
public static void testEjercicio4 () {
|
||||
System.out.println("================ EJERCICIO 4 ================");
|
||||
StringBuilder sbSinMem = new StringBuilder("Sin memoria: \n");
|
||||
StringBuilder sbConMem = new StringBuilder("Con memoria: \n");
|
||||
StringBuilder sbIter = new StringBuilder("Iterativo: \n");
|
||||
|
||||
for(String linea: Files2.linesFromFile("data/PI1Ej4DatosEntrada.txt")) {
|
||||
String[] partes = linea.split(",");
|
||||
Integer a = Integer.valueOf(partes[0]);
|
||||
Integer b = Integer.valueOf(partes[1]);
|
||||
|
||||
sbSinMem.append(Ejercicio4.ejercicio4RecSinMem(a, b));
|
||||
sbSinMem.append("\n");
|
||||
|
||||
sbConMem.append(Ejercicio4.ejercicio4RecConMem(a, b));
|
||||
sbConMem.append("\n");
|
||||
|
||||
sbIter.append(Ejercicio4.ejercicio4Iter(a, b));
|
||||
sbIter.append("\n");
|
||||
}
|
||||
|
||||
System.out.println(sbSinMem.toString());
|
||||
System.out.println(sbConMem.toString());
|
||||
System.out.println(sbIter.toString());
|
||||
System.out.println("=============================================");
|
||||
System.out.println("\n\n");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
testEjercicio1();
|
||||
testEjercicio2();
|
||||
testEjercicio3();
|
||||
testEjercicio4();
|
||||
}
|
||||
|
||||
}
|
||||
7
PI1/src/main/java/adda/util/EnteroCadena.java
Normal file
7
PI1/src/main/java/adda/util/EnteroCadena.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package adda.util;
|
||||
|
||||
public record EnteroCadena(Integer a, String s) {
|
||||
public static EnteroCadena of(Integer a, String s) {
|
||||
return new EnteroCadena(a,s);
|
||||
}
|
||||
}
|
||||
13
PI1/src/main/java/adda/util/TuplaEjercicio2.java
Normal file
13
PI1/src/main/java/adda/util/TuplaEjercicio2.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package adda.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record TuplaEjercicio2(Integer a, Integer b, List<Integer> ac) {
|
||||
public static TuplaEjercicio2 of(Integer a, Integer b, List<Integer> ac) {
|
||||
return new TuplaEjercicio2(a,b,ac);
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return a >= 2 || b >= 2;
|
||||
}
|
||||
}
|
||||
30
PI1/src/main/java/adda/util/TuplaEjercicio3.java
Normal file
30
PI1/src/main/java/adda/util/TuplaEjercicio3.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package adda.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public record TuplaEjercicio3(Iterator<String> iterA, Iterator<String> iterB, List<String> ac) {
|
||||
public static TuplaEjercicio3 of(Iterator<String> iterA, Iterator<String> iterB, List<String> ac) {
|
||||
return new TuplaEjercicio3(iterA, iterB, ac);
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return iterA.hasNext() || iterB.hasNext();
|
||||
}
|
||||
|
||||
public TuplaEjercicio3 next() {
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
if(iterA.hasNext()) {
|
||||
ac.add(iterA.next());
|
||||
}
|
||||
}
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
if(iterB.hasNext()) {
|
||||
ac.add(iterB.next());
|
||||
}
|
||||
}
|
||||
return TuplaEjercicio3.of(iterA, iterB, ac);
|
||||
}
|
||||
}
|
||||
4
PI1/src/main/java/module-info.java
Normal file
4
PI1/src/main/java/module-info.java
Normal file
@@ -0,0 +1,4 @@
|
||||
module pi1 {
|
||||
requires datos_compartidos;
|
||||
requires partecomun;
|
||||
}
|
||||
25
PI2/.classpath
Normal file
25
PI2/.classpath
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/ParteComun">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/DatosCompartidos">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/EjemplosParteComun">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
PI2/.project
Normal file
17
PI2/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PI2</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
6
PI2/data/PI2Ej3DatosEntradaBinary.txt
Normal file
6
PI2/data/PI2Ej3DatosEntradaBinary.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
A(B,C)
|
||||
A(B(D,E(F,G)),C)
|
||||
A(B(D,E(F,G)),C(H,I))
|
||||
A(B(D,E(F,G(J,K))),C(H,I))
|
||||
A(B(/_,G(H,I)),C(D,E(F,/_)))
|
||||
A(B(/_,G(H,I)),C(D,E(F(J,K),/_)))
|
||||
6
PI2/data/PI2Ej3DatosEntradaNary.txt
Normal file
6
PI2/data/PI2Ej3DatosEntradaNary.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
A(B,C,D)
|
||||
A(B(E,F),C,D(G,H,I))
|
||||
A(B(E(/_,J),F),C,D(G,H,I))
|
||||
A(B(E(/_,J),F),C,D(G,H(K,L),I))
|
||||
A(B(E(/_,J),F),C(M,/_),D(G,H(K,L),I))
|
||||
A(B(E(/_,J),F),C(M,/_),D(G,H(K,L(O,O)),I))
|
||||
6
PI2/data/PI2Ej4DatosEntradaBinary.txt
Normal file
6
PI2/data/PI2Ej4DatosEntradaBinary.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
9(6(3,4(2(1,9),1)),7(5,8))
|
||||
9(6(3,4(2(-1,-11),1)),7(5,8))
|
||||
9(6(3,4(2(1(0,/_),9(0,/_)),1(0,/_))),7(5(0,/_),8(0,/_)))
|
||||
9(6(3,4(2(-1(0,/_),-11(0,/_)),1(0,/_))),7(5(0,/_),8(0,/_)))
|
||||
9(6(3,4(2(1(-2,3),9(0,5)),1(4,0))),7(5(0,6),8(0,/_)))
|
||||
9(6(-3,4(2(-1(0,5),-11(5,0)),1(-4,-8))),7(5(-1,/_),8(-2,-3)))
|
||||
6
PI2/data/PI2Ej4DatosEntradaNary.txt
Normal file
6
PI2/data/PI2Ej4DatosEntradaNary.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
9(6(3,4(2(11,15),1),5),7(5,0,2),8)
|
||||
9(6(3,4(2(-1,7,-11),-1),5),7(5,4,6))
|
||||
9(5,6(2,3,4(2(1,-1,9,-5),1)),7(5,8(0,1,2,3)))
|
||||
9(5,6(2,3,4(2(-1,-11),1(2,3,4,5))),7(5,8,0))
|
||||
9(1,2(0,1),3(2(4,5),3),4(6,7(8,10)),5(2,3),6)
|
||||
9(1,2(0,1),3(2(4,5),3(-1(2,-2),1)),4(6,7(8,10)),5(2,3),6)
|
||||
47
PI2/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
47
PI2/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class Ejercicio1 {
|
||||
public static Double fRecDouble(Integer a) {
|
||||
if(a < 6) {
|
||||
return 10.;
|
||||
} else {
|
||||
return Math.pow(a, 3) * fRecDouble(a-1);
|
||||
}
|
||||
}
|
||||
|
||||
public static BigInteger fRecBigInteger(Integer a) {
|
||||
BigInteger res = BigInteger.ZERO;
|
||||
if(a < 6) {
|
||||
res = BigInteger.TEN;
|
||||
} else {
|
||||
res = BigInteger.valueOf(a).pow(3).multiply(fRecBigInteger(a-1));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Double fIterDouble(Integer a) {
|
||||
if (a < 6) {
|
||||
return 10.0;
|
||||
} else {
|
||||
Double result = 10.0;
|
||||
for (int i = 6; i <= a; i++) {
|
||||
result *= Math.pow(i, 3);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static BigInteger fIterBigInteger(Integer a) {
|
||||
BigInteger res = BigInteger.TEN;
|
||||
if (a < 6) {
|
||||
return res;
|
||||
} else {
|
||||
for (int i = 6; i <= a; i++) {
|
||||
res = res.multiply(BigInteger.valueOf(i).pow(3));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
57
PI2/src/main/java/adda/ejercicios/Ejercicio3.java
Normal file
57
PI2/src/main/java/adda/ejercicios/Ejercicio3.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import adda.util.TreeUtilities;
|
||||
import us.lsi.tiposrecursivos.BinaryTree;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BEmpty;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BLeaf;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BTree;
|
||||
import us.lsi.tiposrecursivos.Tree;
|
||||
import us.lsi.tiposrecursivos.Tree.TEmpty;
|
||||
import us.lsi.tiposrecursivos.Tree.TLeaf;
|
||||
import us.lsi.tiposrecursivos.Tree.TNary;
|
||||
|
||||
public class Ejercicio3 {
|
||||
public static Boolean isBalancedBinary(BinaryTree<Character> tree) {
|
||||
return switch(tree) {
|
||||
case BEmpty<Character> t -> true;
|
||||
case BLeaf<Character> t -> true;
|
||||
case BTree<Character> t -> {
|
||||
int heightLeft = TreeUtilities.heightBinary(t.left());
|
||||
int heightRight = TreeUtilities.heightBinary(t.right());
|
||||
|
||||
boolean isLeftBalanced = isBalancedBinary(t.left());
|
||||
boolean isRightBalanced = isBalancedBinary(t.right());
|
||||
|
||||
yield Math.abs(heightLeft - heightRight) <= 1 && isLeftBalanced && isRightBalanced;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Boolean isBalancedNary(Tree<Character> tree) {
|
||||
return switch (tree) {
|
||||
case TEmpty<Character> t -> true;
|
||||
case TLeaf<Character> t -> true;
|
||||
case TNary<Character> t -> {
|
||||
List<Tree<Character>> children = t.children();
|
||||
int maxHeight = t.children().stream().mapToInt(x -> TreeUtilities.heightNary(x)).max().getAsInt();
|
||||
int minHeight = t.children().stream().mapToInt(x -> TreeUtilities.heightNary(x)).min().getAsInt();
|
||||
|
||||
boolean isSubtreesBalanced = isBalancedNary(children, 0);
|
||||
|
||||
yield (maxHeight - minHeight <= 1) && isSubtreesBalanced;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Boolean isBalancedNary(List<Tree<Character>> children, Integer level) {
|
||||
if (level == children.size()) {
|
||||
return true;
|
||||
}
|
||||
Tree<Character> child = children.get(level);
|
||||
boolean isSubtreeBalanced = isBalancedNary(child);
|
||||
return isSubtreeBalanced && isBalancedNary(children, level + 1);
|
||||
}
|
||||
|
||||
}
|
||||
72
PI2/src/main/java/adda/ejercicios/Ejercicio4.java
Normal file
72
PI2/src/main/java/adda/ejercicios/Ejercicio4.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import us.lsi.tiposrecursivos.BinaryTree;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BEmpty;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BLeaf;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BTree;
|
||||
import us.lsi.tiposrecursivos.Tree;
|
||||
import us.lsi.tiposrecursivos.Tree.TEmpty;
|
||||
import us.lsi.tiposrecursivos.Tree.TLeaf;
|
||||
import us.lsi.tiposrecursivos.Tree.TNary;
|
||||
|
||||
public class Ejercicio4 {
|
||||
public static List<List<Integer>> ej4Bin(BinaryTree<Integer> tree) {
|
||||
Function<List<Integer>,Integer> suma = ls -> ls.stream().collect(Collectors.summingInt(i -> i + (i+1)));
|
||||
List<List<Integer>> res = ej4BinAux(tree).stream()
|
||||
.filter(path -> suma.apply(path) % path.size() == 0)
|
||||
.collect(Collectors.toList());
|
||||
return res;
|
||||
}
|
||||
|
||||
public static List<List<Integer>> ej4BinAux(BinaryTree<Integer> tree) {
|
||||
return switch (tree) {
|
||||
case BEmpty<Integer> t -> List.of();
|
||||
case BLeaf<Integer> t -> List.of(new ArrayList<>(List.of(t.optionalLabel().get())));
|
||||
case BTree<Integer> t -> {
|
||||
List<List<Integer>> res = new ArrayList<>();
|
||||
for (List<Integer> path : ej4BinAux(t.left())) {
|
||||
List<Integer> newPath = new ArrayList<>(path);
|
||||
newPath.add(0, t.optionalLabel().get());
|
||||
res.add(newPath);
|
||||
}
|
||||
for (List<Integer> path : ej4BinAux(t.right())) {
|
||||
List<Integer> newPath = new ArrayList<>(path);
|
||||
newPath.add(0, t.optionalLabel().get());
|
||||
res.add(newPath);
|
||||
}
|
||||
yield res;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static List<List<Integer>> ej4Nary(Tree<Integer> tree) {
|
||||
Function<List<Integer>, Integer> suma = ls -> ls.stream().mapToInt(i -> i + (i + 1)).sum();
|
||||
List<List<Integer>> res = ej4NaryAux(tree, suma).stream()
|
||||
.filter(path -> suma.apply(path) % path.size() == 0)
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
return res;
|
||||
}
|
||||
|
||||
private static List<List<Integer>> ej4NaryAux(Tree<Integer> tree, Function<List<Integer>, Integer> suma) {
|
||||
return switch (tree) {
|
||||
case TEmpty<Integer> t -> List.of();
|
||||
case TLeaf<Integer> t -> List.of(new ArrayList<>(List.of(t.optionalLabel().get())));
|
||||
case TNary<Integer> t -> {
|
||||
List<List<Integer>> res = new ArrayList<>();
|
||||
for (Tree<Integer> child : t.children()) {
|
||||
List<List<Integer>> childPaths = ej4NaryAux(child, suma);
|
||||
for (List<Integer> path : childPaths) {
|
||||
path.add(0, t.optionalLabel().get());
|
||||
res.add(new ArrayList<>(path));
|
||||
}
|
||||
}
|
||||
yield res;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
88
PI2/src/main/java/adda/ejercicios/MatrixFibBigInteger.java
Normal file
88
PI2/src/main/java/adda/ejercicios/MatrixFibBigInteger.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
public record MatrixFibBigInteger (BigInteger a, BigInteger b) {
|
||||
|
||||
|
||||
/**
|
||||
* Clase de utilidades para las matrices de Fibonacci, de la forma
|
||||
* |a+b a|
|
||||
* | a b|
|
||||
* Nos referiremos a esas matrices a partir de la tupla (a, b)
|
||||
*/
|
||||
|
||||
public static MatrixFibBigInteger of(BigInteger a, BigInteger b) {
|
||||
return new MatrixFibBigInteger(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (a, b)*(a,b)
|
||||
*/
|
||||
public MatrixFibBigInteger square() {
|
||||
BigInteger a2 = a.pow(2);
|
||||
BigInteger b2 = b.pow(2);
|
||||
BigInteger ab2 = BigInteger.TWO.multiply(a.multiply(b));
|
||||
return of(a2.add(ab2), a2.add(b2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return (1, 0)*(a, b)
|
||||
*/
|
||||
public MatrixFibBigInteger next() {
|
||||
return of(a.add(b), a);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (1, 0)
|
||||
*/
|
||||
public static MatrixFibBigInteger unit() {
|
||||
return of(BigInteger.ONE, BigInteger.ZERO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (0, 1)
|
||||
*/
|
||||
public static MatrixFibBigInteger identity() {
|
||||
return of(BigInteger.ZERO, BigInteger.ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param n
|
||||
* @return potencia((1, 0), n)
|
||||
*/
|
||||
public static MatrixFibBigInteger unitPotencia(Integer n) {
|
||||
MatrixFibBigInteger res = null;
|
||||
if (n == 1) res = unit();
|
||||
else if (n%2 == 0) res = unitPotencia(n/2).square();
|
||||
else res = unitPotencia(n/2).square().next();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param n
|
||||
* @return potencia((a, b), n)
|
||||
*/
|
||||
public MatrixFibBigInteger potencia(Integer n) {
|
||||
MatrixFibBigInteger res = null;
|
||||
if (n == 1) res = of(a, b);
|
||||
else if (n%2 == 0) res = potencia(n/2).square();
|
||||
else res = potencia(n/2).square().multiply(this);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mf
|
||||
* @return (a, b)*mf
|
||||
*/
|
||||
public MatrixFibBigInteger multiply(MatrixFibBigInteger mf) {
|
||||
BigInteger aa = a.multiply(mf.a());
|
||||
BigInteger ab = a.multiply(mf.b());
|
||||
BigInteger ba = b.multiply(mf.a());
|
||||
BigInteger bb = b.multiply(mf.b());
|
||||
return of(aa.add(ab).add(ba), aa.add(bb));
|
||||
}
|
||||
}
|
||||
86
PI2/src/main/java/adda/ejercicios/MatrixFibDouble.java
Normal file
86
PI2/src/main/java/adda/ejercicios/MatrixFibDouble.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
public record MatrixFibDouble (Double a, Double b) {
|
||||
|
||||
|
||||
/**
|
||||
* Clase de utilidades para las matrices de Fibonacci, de la forma
|
||||
* |a+b a|
|
||||
* | a b|
|
||||
* Nos referiremos a esas matrices a partir de la tupla (a, b)
|
||||
*/
|
||||
|
||||
public static MatrixFibDouble of(Double a, Double b) {
|
||||
return new MatrixFibDouble(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (a, b)*(a,b)
|
||||
*/
|
||||
public MatrixFibDouble square() {
|
||||
Double a2 = a*a;
|
||||
Double b2 = b*b;
|
||||
Double ab2 = 2.*a*b;
|
||||
return of(a2+ab2, a2+b2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return (1, 0)*(a, b)
|
||||
*/
|
||||
public MatrixFibDouble next() {
|
||||
return of(a+b, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (1, 0)
|
||||
*/
|
||||
public static MatrixFibDouble unit() {
|
||||
return of(1., 0.);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return (0, 1)
|
||||
*/
|
||||
public static MatrixFibDouble identity() {
|
||||
return of(0., 1.);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param n
|
||||
* @return potencia((1, 0), n)
|
||||
*/
|
||||
public static MatrixFibDouble unitPotencia(Integer n) {
|
||||
MatrixFibDouble res = null;
|
||||
if (n == 1) res = unit();
|
||||
else if (n%2 == 0) res = unitPotencia(n/2).square();
|
||||
else res = unitPotencia(n/2).square().next();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param n
|
||||
* @return potencia((a, b), n)
|
||||
*/
|
||||
public MatrixFibDouble potencia(Integer n) {
|
||||
MatrixFibDouble res = null;
|
||||
if (n == 1) res = of(a, b);
|
||||
else if (n%2 == 0) res = potencia(n/2).square();
|
||||
else res = potencia(n/2).square().multiply(this);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mf
|
||||
* @return (a, b)*mf
|
||||
*/
|
||||
public MatrixFibDouble multiply(MatrixFibDouble mf) {
|
||||
Double aa = a*mf.a();
|
||||
Double ab = a*mf.b();
|
||||
Double ba = b*mf.a();
|
||||
Double bb = b*mf.b();
|
||||
return of(aa+ab+ba, aa+bb);
|
||||
}
|
||||
}
|
||||
|
||||
130
PI2/src/main/java/adda/tests/TestEjercicio1.java
Normal file
130
PI2/src/main/java/adda/tests/TestEjercicio1.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.math3.fitting.WeightedObservedPoint;
|
||||
|
||||
import adda.ejercicios.Ejercicio1;
|
||||
import us.lsi.curvefitting.DataFile;
|
||||
import us.lsi.curvefitting.Fit;
|
||||
import us.lsi.curvefitting.GenData;
|
||||
import us.lsi.curvefitting.PowerLog;
|
||||
import us.lsi.graphics.MatPlotLib;
|
||||
|
||||
public class TestEjercicio1 {
|
||||
|
||||
public static void genDataRD() {
|
||||
Integer nMin = 100; // Valor mínimo de n
|
||||
Integer nMax = 1000; // Valor máximo de n
|
||||
Integer nIncr = 33; // Incremento en los valores de n
|
||||
Integer nIter = 100000; // Número de iteraciones para cada medición de tiempo
|
||||
Integer nIterWarmup = 10000; // Número de iteraciones para warmup
|
||||
|
||||
String file = "ficheros_generados/rd.txt";
|
||||
Function<Integer,Long> f1 = GenData.time(t -> Ejercicio1.fRecDouble(t));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f1,file,nMin,nMax,nIncr,nIter,nIterWarmup);
|
||||
System.out.println("Fin Recursivo Double");
|
||||
}
|
||||
|
||||
public static void genDataRBI() {
|
||||
Integer nMin = 100; // Valor mínimo de n
|
||||
Integer nMax = 1000; // Valor máximo de n
|
||||
Integer nIncr = 33; // Incremento en los valores de n
|
||||
Integer nIter = 2000; // Número de iteraciones para cada medición de tiempo
|
||||
Integer nIterWarmup = 1000; // Número de iteraciones para warmup
|
||||
|
||||
String file = "ficheros_generados/rbi.txt";
|
||||
Function<Integer,Long> f1 = GenData.time(t -> Ejercicio1.fRecBigInteger(t));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f1,file,nMin,nMax,nIncr,nIter,nIterWarmup);
|
||||
System.out.println("Fin Recursivo BigInteger");
|
||||
}
|
||||
|
||||
public static void genDataID() {
|
||||
Integer nMin = 100; // Valor mínimo de n
|
||||
Integer nMax = 1000; // Valor máximo de n
|
||||
Integer nIncr = 33; // Incremento en los valores de n
|
||||
Integer nIter = 2000; // Número de iteraciones para cada medición de tiempo
|
||||
Integer nIterWarmup = 1000; // Número de iteraciones para warmup
|
||||
|
||||
String file = "ficheros_generados/id.txt";
|
||||
Function<Integer,Long> f1 = GenData.time(t -> Ejercicio1.fIterDouble(t));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f1,file,nMin,nMax,nIncr,nIter,nIterWarmup);
|
||||
System.out.println("Fin Iterativo Double");
|
||||
}
|
||||
|
||||
public static void genDataIBI() {
|
||||
Integer nMin = 100; // Valor mínimo de n
|
||||
Integer nMax = 1000; // Valor máximo de n
|
||||
Integer nIncr = 33; // Incremento en los valores de n
|
||||
Integer nIter = 2000; // Número de iteraciones para cada medición de tiempo
|
||||
Integer nIterWarmup = 1000; // Número de iteraciones para warmup
|
||||
|
||||
String file = "ficheros_generados/ibi.txt";
|
||||
Function<Integer,Long> f1 = GenData.time(t -> Ejercicio1.fIterBigInteger(t));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f1,file,nMin,nMax,nIncr,nIter,nIterWarmup);
|
||||
System.out.println("Fin Iterativo BigInteger");
|
||||
}
|
||||
|
||||
public static void showRD() {
|
||||
String file = "ficheros_generados/rd.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void showRBI() {
|
||||
String file = "ficheros_generados/rbi.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void showID() {
|
||||
String file = "ficheros_generados/id.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void showIBI() {
|
||||
String file = "ficheros_generados/ibi.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
genDataRD();
|
||||
genDataRBI();
|
||||
genDataID();
|
||||
genDataIBI();
|
||||
|
||||
showRD();
|
||||
showRBI();
|
||||
showID();
|
||||
showIBI();
|
||||
|
||||
MatPlotLib.showCombined("Comparación", List.of("ficheros_generados/rd.txt","ficheros_generados/rbi.txt",
|
||||
"ficheros_generados/id.txt","ficheros_generados/ibi.txt"),
|
||||
List.of("Recursiva Double","Recursiva BigInteger","Iterativa Double","Iterativa BigInteger"));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
147
PI2/src/main/java/adda/tests/TestEjercicio2.java
Normal file
147
PI2/src/main/java/adda/tests/TestEjercicio2.java
Normal file
@@ -0,0 +1,147 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.math3.fitting.WeightedObservedPoint;
|
||||
|
||||
import us.lsi.curvefitting.DataFile;
|
||||
import us.lsi.curvefitting.Fit;
|
||||
import us.lsi.curvefitting.GenData;
|
||||
import us.lsi.curvefitting.PowerLog;
|
||||
import us.lsi.graphics.MatPlotLib;
|
||||
import us.lsi.recursivos.problemasdelistas.ProblemasDeListas;
|
||||
|
||||
public class TestEjercicio2 {
|
||||
|
||||
private static Integer nMin = 100; // Tamaño mínimo de la lista a ordenar
|
||||
private static Integer nMax = 10000; // Tamaño máximo de la lista a ordenar
|
||||
private static Integer nIncr = 3300; // Incremento en el tamaño de la lista
|
||||
private static Integer nIter = 50; // Número de iteraciones para calcular el
|
||||
private static Integer nIterWarmup = 500; // Número de iteraciones de calentamiento
|
||||
|
||||
private static List<Integer> LIST = new ArrayList<>();
|
||||
private static Random rr = new Random(System.nanoTime());
|
||||
|
||||
|
||||
// Genera una lista de enteros aleatorios de tamaño t y la asigna a la variable
|
||||
// 'list'
|
||||
private static void genList(Integer n) {
|
||||
List<Integer> ls = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
ls.add(rr.nextInt(n + 10000));
|
||||
}
|
||||
LIST = ls; // Genera una lista de enteros aleatorios de tamaño 't'
|
||||
}
|
||||
|
||||
public static void genData1() {
|
||||
String file = "ficheros_generados/mergeSort1.txt";
|
||||
Consumer<Integer> cons = t -> genList(t);
|
||||
Function<Integer, Long> f = GenData.time(cons, t -> ProblemasDeListas.mergeSort(LIST,1));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f, file, nMin, nMax, nIncr, nIter, nIterWarmup);
|
||||
}
|
||||
|
||||
public static void genData4() {
|
||||
String file = "ficheros_generados/mergeSort4.txt";
|
||||
Consumer<Integer> cons = t -> genList(t);
|
||||
Function<Integer, Long> f = GenData.time(cons, t -> ProblemasDeListas.mergeSort(LIST,4));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f, file, nMin, nMax, nIncr, nIter, nIterWarmup);
|
||||
}
|
||||
|
||||
public static void genData16() {
|
||||
String file = "ficheros_generados/mergeSort16.txt";
|
||||
Consumer<Integer> cons = t -> genList(t);
|
||||
Function<Integer, Long> f = GenData.time(cons, t -> ProblemasDeListas.mergeSort(LIST,16));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f, file, nMin, nMax, nIncr, nIter, nIterWarmup);
|
||||
}
|
||||
|
||||
public static void genData64() {
|
||||
String file = "ficheros_generados/mergeSort64.txt";
|
||||
Consumer<Integer> cons = t -> genList(t);
|
||||
Function<Integer, Long> f = GenData.time(cons, t -> ProblemasDeListas.mergeSort(LIST,64));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f, file, nMin, nMax, nIncr, nIter, nIterWarmup);
|
||||
}
|
||||
|
||||
public static void genData256() {
|
||||
String file = "ficheros_generados/mergeSort256.txt";
|
||||
Consumer<Integer> cons = t -> genList(t);
|
||||
Function<Integer, Long> f = GenData.time(cons, t -> ProblemasDeListas.mergeSort(LIST,256));
|
||||
// Integer tMin,Integer tMax,Integer tInc,Integer numIter,Integer numIterWarmup
|
||||
GenData.tiemposEjecucionAritmetica(f, file, nMin, nMax, nIncr, nIter, nIterWarmup);
|
||||
}
|
||||
|
||||
public static void show1() {
|
||||
String file = "ficheros_generados/mergeSort1.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void show4() {
|
||||
String file = "ficheros_generados/mergeSort4.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void show16() {
|
||||
String file = "ficheros_generados/mergeSort16.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void show64() {
|
||||
String file = "ficheros_generados/mergeSort64.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void show256() {
|
||||
String file = "ficheros_generados/mergeSort256.txt";
|
||||
List<WeightedObservedPoint> data = DataFile.points(file);
|
||||
Fit pl = PowerLog.of();
|
||||
pl.fit(data);
|
||||
System.out.println(pl.getExpression());
|
||||
System.out.println(pl.getEvaluation().getRMS());
|
||||
MatPlotLib.show(file, pl.getFunction(), pl.getExpression());
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
genData1();
|
||||
genData4();
|
||||
genData16();
|
||||
genData64();
|
||||
genData256();
|
||||
|
||||
show1();
|
||||
show4();
|
||||
show16();
|
||||
show64();
|
||||
show256();
|
||||
|
||||
MatPlotLib.showCombined("Comparación", List.of("ficheros_generados/mergeSort1.txt","ficheros_generados/mergeSort4.txt",
|
||||
"ficheros_generados/mergeSort16.txt","ficheros_generados/mergeSort64.txt","ficheros_generados/mergeSort256.txt"),
|
||||
List.of("Umbral = 1","Umbral = 4","Umbral = 16","Umbral = 64","Umbral = 256"));
|
||||
}
|
||||
}
|
||||
33
PI2/src/main/java/adda/tests/TestEjercicio3.java
Normal file
33
PI2/src/main/java/adda/tests/TestEjercicio3.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package adda.tests;
|
||||
|
||||
import adda.ejercicios.Ejercicio3;
|
||||
import us.lsi.common.Files2;
|
||||
import us.lsi.tiposrecursivos.BinaryTree;
|
||||
import us.lsi.tiposrecursivos.Tree;
|
||||
|
||||
public class TestEjercicio3 {
|
||||
private static void testBinary() {
|
||||
int i = 1;
|
||||
System.out.println("========= ARBOLES BINARIOS =========");
|
||||
for(String t : Files2.linesFromFile("data/PI2Ej3DatosEntradaBinary.txt")) {
|
||||
BinaryTree<Character> tree = BinaryTree.parse(t,s -> s.charAt(0));
|
||||
System.out.println("Arbol " + i + " equilibrado: " + Ejercicio3.isBalancedBinary(tree));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private static void testNary() {
|
||||
int i = 1;
|
||||
System.out.println("\n\n========= ARBOLES N-ARIOS =========");
|
||||
for(String t : Files2.linesFromFile("data/PI2Ej3DatosEntradaNary.txt")) {
|
||||
Tree<Character> tree = Tree.parse(t,s -> s.charAt(0));
|
||||
System.out.println("Arbol " + i + " equilibrado: " + Ejercicio3.isBalancedNary(tree));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
testBinary();
|
||||
testNary();
|
||||
}
|
||||
}
|
||||
41
PI2/src/main/java/adda/tests/TestEjercicio4.java
Normal file
41
PI2/src/main/java/adda/tests/TestEjercicio4.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import adda.ejercicios.Ejercicio4;
|
||||
import us.lsi.common.Files2;
|
||||
import us.lsi.tiposrecursivos.BinaryTree;
|
||||
import us.lsi.tiposrecursivos.Tree;
|
||||
|
||||
public class TestEjercicio4 {
|
||||
|
||||
public static void testBinary() {
|
||||
System.out.println("BINARIO:");
|
||||
for(String linea : Files2.linesFromFile("data/PI2Ej4DatosEntradaBinary.txt")) {
|
||||
BinaryTree<Integer> t = BinaryTree.parse(linea, Integer::parseInt);
|
||||
List<List<Integer>> caminos = Ejercicio4.ej4Bin(t);
|
||||
System.out.println("Arbol: " + linea);
|
||||
for(List<Integer> camino : caminos) {
|
||||
System.out.println(" " + camino);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void testNary() {
|
||||
System.out.println("\n\nN-ARIO:");
|
||||
for(String linea : Files2.linesFromFile("data/PI2Ej4DatosEntradaNary.txt")) {
|
||||
Tree<Integer> t = Tree.parse(linea, Integer::parseInt);
|
||||
List<List<Integer>> caminos = Ejercicio4.ej4Nary(t);
|
||||
System.out.println("Arbol: " + linea);
|
||||
for(List<Integer> camino : caminos) {
|
||||
System.out.println(" " + camino);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void test() {
|
||||
testBinary();
|
||||
testNary();
|
||||
}
|
||||
}
|
||||
49
PI2/src/main/java/adda/tests/Tests.java
Normal file
49
PI2/src/main/java/adda/tests/Tests.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Tests {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner s = new Scanner(System.in);
|
||||
while (true) {
|
||||
System.out.println("\nIntroduce el ejercicio a ejecutar:");
|
||||
System.out.println("1. Ejercicio 1");
|
||||
System.out.println("2. Ejercicio 2");
|
||||
System.out.println("3. Ejercicio 3");
|
||||
System.out.println("4. Ejercicio 4");
|
||||
System.out.println("5. Salir");
|
||||
|
||||
int opcion = s.nextInt();
|
||||
|
||||
try {
|
||||
switch (opcion) {
|
||||
case 1:
|
||||
System.out.println("===== EJERCICIO 1 =====");
|
||||
TestEjercicio1.test();
|
||||
break;
|
||||
case 2:
|
||||
System.out.println("===== EJERCICIO 2 =====");
|
||||
TestEjercicio2.test();
|
||||
break;
|
||||
case 3:
|
||||
System.out.println("===== EJERCICIO 3 =====");
|
||||
TestEjercicio3.test();
|
||||
break;
|
||||
case 4:
|
||||
System.out.println("===== EJERCICIO 4 =====");
|
||||
TestEjercicio4.test();
|
||||
break;
|
||||
case 5:
|
||||
System.out.println("Saliendo...");
|
||||
s.close();
|
||||
System.exit(0);
|
||||
default:
|
||||
System.out.println("Ejercicio no válido.");
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.out.println("Excepcion: \n" + " " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
PI2/src/main/java/adda/util/TreeUtilities.java
Normal file
28
PI2/src/main/java/adda/util/TreeUtilities.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package adda.util;
|
||||
|
||||
import us.lsi.tiposrecursivos.BinaryTree;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BEmpty;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BLeaf;
|
||||
import us.lsi.tiposrecursivos.BinaryTree.BTree;
|
||||
import us.lsi.tiposrecursivos.Tree;
|
||||
import us.lsi.tiposrecursivos.Tree.TEmpty;
|
||||
import us.lsi.tiposrecursivos.Tree.TLeaf;
|
||||
import us.lsi.tiposrecursivos.Tree.TNary;
|
||||
|
||||
public class TreeUtilities {
|
||||
public static int heightBinary(BinaryTree<Character> tree) {
|
||||
return switch (tree) {
|
||||
case BEmpty<Character> t -> 0;
|
||||
case BLeaf<Character> t -> 0;
|
||||
case BTree<Character> t -> Math.max(heightBinary(t.left()), heightBinary(t.right())) +1;
|
||||
};
|
||||
}
|
||||
|
||||
public static int heightNary(Tree<Character> tree) {
|
||||
return switch (tree) {
|
||||
case TEmpty<Character> t -> 0;
|
||||
case TLeaf<Character> t -> 1;
|
||||
case TNary<Character> t -> t.children().stream().mapToInt(c -> heightNary(c)).max().orElse(0) + 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
5
PI2/src/main/java/module-info.java
Normal file
5
PI2/src/main/java/module-info.java
Normal file
@@ -0,0 +1,5 @@
|
||||
module pi2 {
|
||||
requires datos_compartidos;
|
||||
requires partecomun;
|
||||
requires ejemplos_parte_comun;
|
||||
}
|
||||
25
PI3/.classpath
Normal file
25
PI3/.classpath
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-20">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/DatosCompartidos">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Grafos">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/ParteComun">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
PI3/.project
Normal file
17
PI3/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PI3</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
43
PI3/exports/ejercicio1a_1.dot
Normal file
43
PI3/exports/ejercicio1a_1.dot
Normal file
@@ -0,0 +1,43 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="blue" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="blue" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Laura" ];
|
||||
14 [ color="black" label="Carlos" ];
|
||||
15 [ color="black" label="Sara" ];
|
||||
2 -> 5 [ color="blue" label="4.0" ];
|
||||
1 -> 3 [ color="black" label="3.7" ];
|
||||
3 -> 4 [ color="black" label="4.2" ];
|
||||
5 -> 1 [ color="black" label="3.8" ];
|
||||
1 -> 12 [ color="black" label="4.1" ];
|
||||
10 -> 5 [ color="black" label="4.3" ];
|
||||
2 -> 3 [ color="black" label="3.8" ];
|
||||
2 -> 8 [ color="black" label="2.7" ];
|
||||
2 -> 12 [ color="black" label="3.1" ];
|
||||
11 -> 12 [ color="black" label="4.5" ];
|
||||
2 -> 9 [ color="black" label="1.8" ];
|
||||
4 -> 5 [ color="black" label="3.9" ];
|
||||
5 -> 7 [ color="black" label="4.0" ];
|
||||
5 -> 12 [ color="black" label="3.0" ];
|
||||
6 -> 3 [ color="black" label="3.6" ];
|
||||
8 -> 5 [ color="black" label="4.2" ];
|
||||
5 -> 3 [ color="black" label="3.5" ];
|
||||
10 -> 11 [ color="black" label="4.0" ];
|
||||
7 -> 4 [ color="black" label="5.0" ];
|
||||
11 -> 5 [ color="black" label="4.3" ];
|
||||
12 -> 9 [ color="black" label="3.8" ];
|
||||
10 -> 3 [ color="black" label="4.1" ];
|
||||
8 -> 12 [ color="black" label="3.2" ];
|
||||
13 -> 14 [ color="black" label="4.0" ];
|
||||
14 -> 15 [ color="black" label="3.9" ];
|
||||
15 -> 13 [ color="black" label="4.2" ];
|
||||
}
|
||||
60
PI3/exports/ejercicio1a_2.dot
Normal file
60
PI3/exports/ejercicio1a_2.dot
Normal file
@@ -0,0 +1,60 @@
|
||||
strict digraph G {
|
||||
1 [ color="blue" label="Diana" ];
|
||||
2 [ color="black" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Carlos" ];
|
||||
14 [ color="blue" label="Daniel" ];
|
||||
15 [ color="blue" label="Javier" ];
|
||||
16 [ color="blue" label="Maria del Mar" ];
|
||||
17 [ color="black" label="Carmelo" ];
|
||||
18 [ color="black" label="Luis" ];
|
||||
19 [ color="black" label="Ana" ];
|
||||
20 [ color="black" label="Roberto" ];
|
||||
21 [ color="black" label="Sofía" ];
|
||||
1 -> 2 [ color="black" label="3.9" ];
|
||||
1 -> 14 [ color="blue" label="3.7" ];
|
||||
1 -> 15 [ color="blue" label="4.1" ];
|
||||
1 -> 16 [ color="blue" label="4.0" ];
|
||||
14 -> 2 [ color="black" label="4.1" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 12 [ color="black" label="4.2" ];
|
||||
14 -> 10 [ color="black" label="4.3" ];
|
||||
15 -> 2 [ color="black" label="4.0" ];
|
||||
15 -> 8 [ color="black" label="3.9" ];
|
||||
15 -> 12 [ color="black" label="4.1" ];
|
||||
15 -> 10 [ color="black" label="4.0" ];
|
||||
16 -> 2 [ color="black" label="4.2" ];
|
||||
16 -> 8 [ color="black" label="3.8" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 4 [ color="black" label="4.3" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
3 -> 15 [ color="black" label="4.0" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
10 -> 14 [ color="black" label="4.1" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
2 -> 9 [ color="black" label="3.0" ];
|
||||
3 -> 4 [ color="black" label="3.9" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
5 -> 7 [ color="black" label="4.1" ];
|
||||
6 -> 15 [ color="black" label="4.1" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
5 -> 3 [ color="black" label="4.2" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
18 -> 19 [ color="black" label="4.0" ];
|
||||
19 -> 20 [ color="black" label="3.9" ];
|
||||
20 -> 21 [ color="black" label="4.1" ];
|
||||
21 -> 18 [ color="black" label="4.2" ];
|
||||
}
|
||||
49
PI3/exports/ejercicio1a_3.dot
Normal file
49
PI3/exports/ejercicio1a_3.dot
Normal file
@@ -0,0 +1,49 @@
|
||||
strict digraph G {
|
||||
1 [ color="blue" label="Diana" ];
|
||||
2 [ color="blue" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="blue" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Carlos" ];
|
||||
14 [ color="blue" label="Daniel" ];
|
||||
15 [ color="black" label="Javier" ];
|
||||
16 [ color="blue" label="Maria del Mar" ];
|
||||
17 [ color="black" label="Carmelo" ];
|
||||
1 -> 2 [ color="blue" label="3.9" ];
|
||||
1 -> 14 [ color="blue" label="3.7" ];
|
||||
1 -> 15 [ color="black" label="4.1" ];
|
||||
1 -> 16 [ color="blue" label="4.2" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
2 -> 3 [ color="black" label="4.1" ];
|
||||
2 -> 4 [ color="black" label="3.6" ];
|
||||
2 -> 10 [ color="blue" label="3.8" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 10 [ color="blue" label="4.3" ];
|
||||
14 -> 13 [ color="black" label="3.6" ];
|
||||
14 -> 17 [ color="black" label="3.7" ];
|
||||
16 -> 2 [ color="blue" label="4.2" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 6 [ color="black" label="4.0" ];
|
||||
16 -> 11 [ color="black" label="4.3" ];
|
||||
10 -> 14 [ color="blue" label="4.1" ];
|
||||
10 -> 13 [ color="black" label="3.9" ];
|
||||
10 -> 17 [ color="black" label="4.0" ];
|
||||
10 -> 7 [ color="black" label="3.8" ];
|
||||
15 -> 4 [ color="black" label="4.0" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
}
|
||||
43
PI3/exports/ejercicio1b_1.dot
Normal file
43
PI3/exports/ejercicio1b_1.dot
Normal file
@@ -0,0 +1,43 @@
|
||||
strict digraph G {
|
||||
1 [ color="blue" label="Diana" ];
|
||||
2 [ color="blue" label="Guti" ];
|
||||
3 [ color="blue" label="David" ];
|
||||
4 [ color="blue" label="Miguel" ];
|
||||
5 [ color="blue" label="Belen" ];
|
||||
6 [ color="blue" label="Rafael" ];
|
||||
7 [ color="blue" label="Paco" ];
|
||||
8 [ color="blue" label="Elena" ];
|
||||
9 [ color="blue" label="Fernando" ];
|
||||
10 [ color="blue" label="Irene" ];
|
||||
11 [ color="blue" label="Antonio" ];
|
||||
12 [ color="blue" label="Maria" ];
|
||||
13 [ color="red" label="Laura" ];
|
||||
14 [ color="red" label="Carlos" ];
|
||||
15 [ color="red" label="Sara" ];
|
||||
2 -> 5 [ color="blue" label="4.0" ];
|
||||
1 -> 3 [ color="blue" label="3.7" ];
|
||||
3 -> 4 [ color="blue" label="4.2" ];
|
||||
5 -> 1 [ color="blue" label="3.8" ];
|
||||
1 -> 12 [ color="blue" label="4.1" ];
|
||||
10 -> 5 [ color="blue" label="4.3" ];
|
||||
2 -> 3 [ color="blue" label="3.8" ];
|
||||
2 -> 8 [ color="blue" label="2.7" ];
|
||||
2 -> 12 [ color="blue" label="3.1" ];
|
||||
11 -> 12 [ color="blue" label="4.5" ];
|
||||
2 -> 9 [ color="blue" label="1.8" ];
|
||||
4 -> 5 [ color="blue" label="3.9" ];
|
||||
5 -> 7 [ color="blue" label="4.0" ];
|
||||
5 -> 12 [ color="blue" label="3.0" ];
|
||||
6 -> 3 [ color="blue" label="3.6" ];
|
||||
8 -> 5 [ color="blue" label="4.2" ];
|
||||
5 -> 3 [ color="blue" label="3.5" ];
|
||||
10 -> 11 [ color="blue" label="4.0" ];
|
||||
7 -> 4 [ color="blue" label="5.0" ];
|
||||
11 -> 5 [ color="blue" label="4.3" ];
|
||||
12 -> 9 [ color="blue" label="3.8" ];
|
||||
10 -> 3 [ color="blue" label="4.1" ];
|
||||
8 -> 12 [ color="blue" label="3.2" ];
|
||||
13 -> 14 [ color="red" label="4.0" ];
|
||||
14 -> 15 [ color="red" label="3.9" ];
|
||||
15 -> 13 [ color="red" label="4.2" ];
|
||||
}
|
||||
60
PI3/exports/ejercicio1b_2.dot
Normal file
60
PI3/exports/ejercicio1b_2.dot
Normal file
@@ -0,0 +1,60 @@
|
||||
strict digraph G {
|
||||
1 [ color="blue" label="Diana" ];
|
||||
2 [ color="blue" label="Guti" ];
|
||||
3 [ color="blue" label="David" ];
|
||||
4 [ color="blue" label="Miguel" ];
|
||||
5 [ color="blue" label="Belen" ];
|
||||
6 [ color="blue" label="Rafael" ];
|
||||
7 [ color="blue" label="Paco" ];
|
||||
8 [ color="blue" label="Elena" ];
|
||||
9 [ color="blue" label="Fernando" ];
|
||||
10 [ color="blue" label="Irene" ];
|
||||
11 [ color="blue" label="Antonio" ];
|
||||
12 [ color="blue" label="Maria" ];
|
||||
13 [ color="blue" label="Carlos" ];
|
||||
14 [ color="blue" label="Daniel" ];
|
||||
15 [ color="blue" label="Javier" ];
|
||||
16 [ color="blue" label="Maria del Mar" ];
|
||||
17 [ color="blue" label="Carmelo" ];
|
||||
18 [ color="red" label="Luis" ];
|
||||
19 [ color="red" label="Ana" ];
|
||||
20 [ color="red" label="Roberto" ];
|
||||
21 [ color="red" label="Sofía" ];
|
||||
1 -> 2 [ color="blue" label="3.9" ];
|
||||
1 -> 14 [ color="blue" label="3.7" ];
|
||||
1 -> 15 [ color="blue" label="4.1" ];
|
||||
1 -> 16 [ color="blue" label="4.0" ];
|
||||
14 -> 2 [ color="blue" label="4.1" ];
|
||||
14 -> 8 [ color="blue" label="3.5" ];
|
||||
14 -> 12 [ color="blue" label="4.2" ];
|
||||
14 -> 10 [ color="blue" label="4.3" ];
|
||||
15 -> 2 [ color="blue" label="4.0" ];
|
||||
15 -> 8 [ color="blue" label="3.9" ];
|
||||
15 -> 12 [ color="blue" label="4.1" ];
|
||||
15 -> 10 [ color="blue" label="4.0" ];
|
||||
16 -> 2 [ color="blue" label="4.2" ];
|
||||
16 -> 8 [ color="blue" label="3.8" ];
|
||||
16 -> 3 [ color="blue" label="4.1" ];
|
||||
16 -> 4 [ color="blue" label="4.3" ];
|
||||
13 -> 8 [ color="blue" label="3.8" ];
|
||||
17 -> 8 [ color="blue" label="3.9" ];
|
||||
3 -> 15 [ color="blue" label="4.0" ];
|
||||
5 -> 16 [ color="blue" label="3.9" ];
|
||||
10 -> 14 [ color="blue" label="4.1" ];
|
||||
2 -> 12 [ color="blue" label="4.0" ];
|
||||
11 -> 17 [ color="blue" label="4.2" ];
|
||||
2 -> 9 [ color="blue" label="3.0" ];
|
||||
3 -> 4 [ color="blue" label="3.9" ];
|
||||
4 -> 16 [ color="blue" label="4.0" ];
|
||||
5 -> 7 [ color="blue" label="4.1" ];
|
||||
6 -> 15 [ color="blue" label="4.1" ];
|
||||
8 -> 14 [ color="blue" label="4.3" ];
|
||||
5 -> 3 [ color="blue" label="4.2" ];
|
||||
7 -> 17 [ color="blue" label="4.5" ];
|
||||
12 -> 13 [ color="blue" label="4.1" ];
|
||||
8 -> 17 [ color="blue" label="3.4" ];
|
||||
18 -> 19 [ color="red" label="4.0" ];
|
||||
19 -> 20 [ color="red" label="3.9" ];
|
||||
20 -> 21 [ color="red" label="4.1" ];
|
||||
21 -> 18 [ color="red" label="4.2" ];
|
||||
}
|
||||
49
PI3/exports/ejercicio1b_3.dot
Normal file
49
PI3/exports/ejercicio1b_3.dot
Normal file
@@ -0,0 +1,49 @@
|
||||
strict digraph G {
|
||||
1 [ color="blue" label="Diana" ];
|
||||
2 [ color="blue" label="Guti" ];
|
||||
3 [ color="blue" label="David" ];
|
||||
4 [ color="blue" label="Miguel" ];
|
||||
5 [ color="blue" label="Belen" ];
|
||||
6 [ color="blue" label="Rafael" ];
|
||||
7 [ color="blue" label="Paco" ];
|
||||
8 [ color="blue" label="Elena" ];
|
||||
9 [ color="red" label="Fernando" ];
|
||||
10 [ color="blue" label="Irene" ];
|
||||
11 [ color="blue" label="Antonio" ];
|
||||
12 [ color="blue" label="Maria" ];
|
||||
13 [ color="blue" label="Carlos" ];
|
||||
14 [ color="blue" label="Daniel" ];
|
||||
15 [ color="blue" label="Javier" ];
|
||||
16 [ color="blue" label="Maria del Mar" ];
|
||||
17 [ color="blue" label="Carmelo" ];
|
||||
1 -> 2 [ color="blue" label="3.9" ];
|
||||
1 -> 14 [ color="blue" label="3.7" ];
|
||||
1 -> 15 [ color="blue" label="4.1" ];
|
||||
1 -> 16 [ color="blue" label="4.2" ];
|
||||
2 -> 12 [ color="blue" label="4.0" ];
|
||||
2 -> 3 [ color="blue" label="4.1" ];
|
||||
2 -> 4 [ color="blue" label="3.6" ];
|
||||
2 -> 10 [ color="blue" label="3.8" ];
|
||||
14 -> 8 [ color="blue" label="3.5" ];
|
||||
14 -> 10 [ color="blue" label="4.3" ];
|
||||
14 -> 13 [ color="blue" label="3.6" ];
|
||||
14 -> 17 [ color="blue" label="3.7" ];
|
||||
16 -> 2 [ color="blue" label="4.2" ];
|
||||
16 -> 3 [ color="blue" label="4.1" ];
|
||||
16 -> 6 [ color="blue" label="4.0" ];
|
||||
16 -> 11 [ color="blue" label="4.3" ];
|
||||
10 -> 14 [ color="blue" label="4.1" ];
|
||||
10 -> 13 [ color="blue" label="3.9" ];
|
||||
10 -> 17 [ color="blue" label="4.0" ];
|
||||
10 -> 7 [ color="blue" label="3.8" ];
|
||||
15 -> 4 [ color="blue" label="4.0" ];
|
||||
4 -> 16 [ color="blue" label="4.0" ];
|
||||
13 -> 8 [ color="blue" label="3.8" ];
|
||||
17 -> 8 [ color="blue" label="3.9" ];
|
||||
5 -> 16 [ color="blue" label="3.9" ];
|
||||
11 -> 17 [ color="blue" label="4.2" ];
|
||||
8 -> 14 [ color="blue" label="4.3" ];
|
||||
7 -> 17 [ color="blue" label="4.5" ];
|
||||
12 -> 13 [ color="blue" label="4.1" ];
|
||||
8 -> 17 [ color="blue" label="3.4" ];
|
||||
}
|
||||
43
PI3/exports/ejercicio1c_1.dot
Normal file
43
PI3/exports/ejercicio1c_1.dot
Normal file
@@ -0,0 +1,43 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="red" label="Guti" ];
|
||||
3 [ color="red" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="red" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="red" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="red" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="red" label="Maria" ];
|
||||
13 [ color="black" label="Laura" ];
|
||||
14 [ color="red" label="Carlos" ];
|
||||
15 [ color="red" label="Sara" ];
|
||||
2 -> 5 [ color="black" label="4.0" ];
|
||||
1 -> 3 [ color="black" label="3.7" ];
|
||||
3 -> 4 [ color="black" label="4.2" ];
|
||||
5 -> 1 [ color="black" label="3.8" ];
|
||||
1 -> 12 [ color="black" label="4.1" ];
|
||||
10 -> 5 [ color="black" label="4.3" ];
|
||||
2 -> 3 [ color="black" label="3.8" ];
|
||||
2 -> 8 [ color="black" label="2.7" ];
|
||||
2 -> 12 [ color="black" label="3.1" ];
|
||||
11 -> 12 [ color="black" label="4.5" ];
|
||||
2 -> 9 [ color="black" label="1.8" ];
|
||||
4 -> 5 [ color="black" label="3.9" ];
|
||||
5 -> 7 [ color="black" label="4.0" ];
|
||||
5 -> 12 [ color="black" label="3.0" ];
|
||||
6 -> 3 [ color="black" label="3.6" ];
|
||||
8 -> 5 [ color="black" label="4.2" ];
|
||||
5 -> 3 [ color="black" label="3.5" ];
|
||||
10 -> 11 [ color="black" label="4.0" ];
|
||||
7 -> 4 [ color="black" label="5.0" ];
|
||||
11 -> 5 [ color="black" label="4.3" ];
|
||||
12 -> 9 [ color="black" label="3.8" ];
|
||||
10 -> 3 [ color="black" label="4.1" ];
|
||||
8 -> 12 [ color="black" label="3.2" ];
|
||||
13 -> 14 [ color="black" label="4.0" ];
|
||||
14 -> 15 [ color="black" label="3.9" ];
|
||||
15 -> 13 [ color="black" label="4.2" ];
|
||||
}
|
||||
60
PI3/exports/ejercicio1c_2.dot
Normal file
60
PI3/exports/ejercicio1c_2.dot
Normal file
@@ -0,0 +1,60 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="red" label="Guti" ];
|
||||
3 [ color="red" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="red" label="Paco" ];
|
||||
8 [ color="red" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="red" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="red" label="Carlos" ];
|
||||
14 [ color="red" label="Daniel" ];
|
||||
15 [ color="red" label="Javier" ];
|
||||
16 [ color="red" label="Maria del Mar" ];
|
||||
17 [ color="black" label="Carmelo" ];
|
||||
18 [ color="red" label="Luis" ];
|
||||
19 [ color="black" label="Ana" ];
|
||||
20 [ color="red" label="Roberto" ];
|
||||
21 [ color="black" label="Sofía" ];
|
||||
1 -> 2 [ color="black" label="3.9" ];
|
||||
1 -> 14 [ color="black" label="3.7" ];
|
||||
1 -> 15 [ color="black" label="4.1" ];
|
||||
1 -> 16 [ color="black" label="4.0" ];
|
||||
14 -> 2 [ color="black" label="4.1" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 12 [ color="black" label="4.2" ];
|
||||
14 -> 10 [ color="black" label="4.3" ];
|
||||
15 -> 2 [ color="black" label="4.0" ];
|
||||
15 -> 8 [ color="black" label="3.9" ];
|
||||
15 -> 12 [ color="black" label="4.1" ];
|
||||
15 -> 10 [ color="black" label="4.0" ];
|
||||
16 -> 2 [ color="black" label="4.2" ];
|
||||
16 -> 8 [ color="black" label="3.8" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 4 [ color="black" label="4.3" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
3 -> 15 [ color="black" label="4.0" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
10 -> 14 [ color="black" label="4.1" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
2 -> 9 [ color="black" label="3.0" ];
|
||||
3 -> 4 [ color="black" label="3.9" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
5 -> 7 [ color="black" label="4.1" ];
|
||||
6 -> 15 [ color="black" label="4.1" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
5 -> 3 [ color="black" label="4.2" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
18 -> 19 [ color="black" label="4.0" ];
|
||||
19 -> 20 [ color="black" label="3.9" ];
|
||||
20 -> 21 [ color="black" label="4.1" ];
|
||||
21 -> 18 [ color="black" label="4.2" ];
|
||||
}
|
||||
49
PI3/exports/ejercicio1c_3.dot
Normal file
49
PI3/exports/ejercicio1c_3.dot
Normal file
@@ -0,0 +1,49 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="red" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="red" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="red" label="Carlos" ];
|
||||
14 [ color="red" label="Daniel" ];
|
||||
15 [ color="red" label="Javier" ];
|
||||
16 [ color="red" label="Maria del Mar" ];
|
||||
17 [ color="red" label="Carmelo" ];
|
||||
1 -> 2 [ color="black" label="3.9" ];
|
||||
1 -> 14 [ color="black" label="3.7" ];
|
||||
1 -> 15 [ color="black" label="4.1" ];
|
||||
1 -> 16 [ color="black" label="4.2" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
2 -> 3 [ color="black" label="4.1" ];
|
||||
2 -> 4 [ color="black" label="3.6" ];
|
||||
2 -> 10 [ color="black" label="3.8" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 10 [ color="black" label="4.3" ];
|
||||
14 -> 13 [ color="black" label="3.6" ];
|
||||
14 -> 17 [ color="black" label="3.7" ];
|
||||
16 -> 2 [ color="black" label="4.2" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 6 [ color="black" label="4.0" ];
|
||||
16 -> 11 [ color="black" label="4.3" ];
|
||||
10 -> 14 [ color="black" label="4.1" ];
|
||||
10 -> 13 [ color="black" label="3.9" ];
|
||||
10 -> 17 [ color="black" label="4.0" ];
|
||||
10 -> 7 [ color="black" label="3.8" ];
|
||||
15 -> 4 [ color="black" label="4.0" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
}
|
||||
43
PI3/exports/ejercicio1d_1.dot
Normal file
43
PI3/exports/ejercicio1d_1.dot
Normal file
@@ -0,0 +1,43 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="black" label="Guti" ];
|
||||
3 [ color="red" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="red" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Laura" ];
|
||||
14 [ color="black" label="Carlos" ];
|
||||
15 [ color="black" label="Sara" ];
|
||||
2 -> 5 [ color="black" label="4.0" ];
|
||||
1 -> 3 [ color="black" label="3.7" ];
|
||||
3 -> 4 [ color="black" label="4.2" ];
|
||||
5 -> 1 [ color="black" label="3.8" ];
|
||||
1 -> 12 [ color="black" label="4.1" ];
|
||||
10 -> 5 [ color="black" label="4.3" ];
|
||||
2 -> 3 [ color="black" label="3.8" ];
|
||||
2 -> 8 [ color="black" label="2.7" ];
|
||||
2 -> 12 [ color="black" label="3.1" ];
|
||||
11 -> 12 [ color="black" label="4.5" ];
|
||||
2 -> 9 [ color="black" label="1.8" ];
|
||||
4 -> 5 [ color="black" label="3.9" ];
|
||||
5 -> 7 [ color="black" label="4.0" ];
|
||||
5 -> 12 [ color="black" label="3.0" ];
|
||||
6 -> 3 [ color="black" label="3.6" ];
|
||||
8 -> 5 [ color="black" label="4.2" ];
|
||||
5 -> 3 [ color="black" label="3.5" ];
|
||||
10 -> 11 [ color="black" label="4.0" ];
|
||||
7 -> 4 [ color="black" label="5.0" ];
|
||||
11 -> 5 [ color="black" label="4.3" ];
|
||||
12 -> 9 [ color="black" label="3.8" ];
|
||||
10 -> 3 [ color="black" label="4.1" ];
|
||||
8 -> 12 [ color="black" label="3.2" ];
|
||||
13 -> 14 [ color="black" label="4.0" ];
|
||||
14 -> 15 [ color="black" label="3.9" ];
|
||||
15 -> 13 [ color="black" label="4.2" ];
|
||||
}
|
||||
60
PI3/exports/ejercicio1d_2.dot
Normal file
60
PI3/exports/ejercicio1d_2.dot
Normal file
@@ -0,0 +1,60 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="black" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="red" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Carlos" ];
|
||||
14 [ color="black" label="Daniel" ];
|
||||
15 [ color="black" label="Javier" ];
|
||||
16 [ color="black" label="Maria del Mar" ];
|
||||
17 [ color="black" label="Carmelo" ];
|
||||
18 [ color="black" label="Luis" ];
|
||||
19 [ color="black" label="Ana" ];
|
||||
20 [ color="black" label="Roberto" ];
|
||||
21 [ color="black" label="Sofía" ];
|
||||
1 -> 2 [ color="black" label="3.9" ];
|
||||
1 -> 14 [ color="black" label="3.7" ];
|
||||
1 -> 15 [ color="black" label="4.1" ];
|
||||
1 -> 16 [ color="black" label="4.0" ];
|
||||
14 -> 2 [ color="black" label="4.1" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 12 [ color="black" label="4.2" ];
|
||||
14 -> 10 [ color="black" label="4.3" ];
|
||||
15 -> 2 [ color="black" label="4.0" ];
|
||||
15 -> 8 [ color="black" label="3.9" ];
|
||||
15 -> 12 [ color="black" label="4.1" ];
|
||||
15 -> 10 [ color="black" label="4.0" ];
|
||||
16 -> 2 [ color="black" label="4.2" ];
|
||||
16 -> 8 [ color="black" label="3.8" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 4 [ color="black" label="4.3" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
3 -> 15 [ color="black" label="4.0" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
10 -> 14 [ color="black" label="4.1" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
2 -> 9 [ color="black" label="3.0" ];
|
||||
3 -> 4 [ color="black" label="3.9" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
5 -> 7 [ color="black" label="4.1" ];
|
||||
6 -> 15 [ color="black" label="4.1" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
5 -> 3 [ color="black" label="4.2" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
18 -> 19 [ color="black" label="4.0" ];
|
||||
19 -> 20 [ color="black" label="3.9" ];
|
||||
20 -> 21 [ color="black" label="4.1" ];
|
||||
21 -> 18 [ color="black" label="4.2" ];
|
||||
}
|
||||
49
PI3/exports/ejercicio1d_3.dot
Normal file
49
PI3/exports/ejercicio1d_3.dot
Normal file
@@ -0,0 +1,49 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Diana" ];
|
||||
2 [ color="black" label="Guti" ];
|
||||
3 [ color="black" label="David" ];
|
||||
4 [ color="black" label="Miguel" ];
|
||||
5 [ color="black" label="Belen" ];
|
||||
6 [ color="black" label="Rafael" ];
|
||||
7 [ color="black" label="Paco" ];
|
||||
8 [ color="black" label="Elena" ];
|
||||
9 [ color="black" label="Fernando" ];
|
||||
10 [ color="black" label="Irene" ];
|
||||
11 [ color="black" label="Antonio" ];
|
||||
12 [ color="black" label="Maria" ];
|
||||
13 [ color="black" label="Carlos" ];
|
||||
14 [ color="black" label="Daniel" ];
|
||||
15 [ color="black" label="Javier" ];
|
||||
16 [ color="black" label="Maria del Mar" ];
|
||||
17 [ color="red" label="Carmelo" ];
|
||||
1 -> 2 [ color="black" label="3.9" ];
|
||||
1 -> 14 [ color="black" label="3.7" ];
|
||||
1 -> 15 [ color="black" label="4.1" ];
|
||||
1 -> 16 [ color="black" label="4.2" ];
|
||||
2 -> 12 [ color="black" label="4.0" ];
|
||||
2 -> 3 [ color="black" label="4.1" ];
|
||||
2 -> 4 [ color="black" label="3.6" ];
|
||||
2 -> 10 [ color="black" label="3.8" ];
|
||||
14 -> 8 [ color="black" label="3.5" ];
|
||||
14 -> 10 [ color="black" label="4.3" ];
|
||||
14 -> 13 [ color="black" label="3.6" ];
|
||||
14 -> 17 [ color="black" label="3.7" ];
|
||||
16 -> 2 [ color="black" label="4.2" ];
|
||||
16 -> 3 [ color="black" label="4.1" ];
|
||||
16 -> 6 [ color="black" label="4.0" ];
|
||||
16 -> 11 [ color="black" label="4.3" ];
|
||||
10 -> 14 [ color="black" label="4.1" ];
|
||||
10 -> 13 [ color="black" label="3.9" ];
|
||||
10 -> 17 [ color="black" label="4.0" ];
|
||||
10 -> 7 [ color="black" label="3.8" ];
|
||||
15 -> 4 [ color="black" label="4.0" ];
|
||||
4 -> 16 [ color="black" label="4.0" ];
|
||||
13 -> 8 [ color="black" label="3.8" ];
|
||||
17 -> 8 [ color="black" label="3.9" ];
|
||||
5 -> 16 [ color="black" label="3.9" ];
|
||||
11 -> 17 [ color="black" label="4.2" ];
|
||||
8 -> 14 [ color="black" label="4.3" ];
|
||||
7 -> 17 [ color="black" label="4.5" ];
|
||||
12 -> 13 [ color="black" label="4.1" ];
|
||||
8 -> 17 [ color="black" label="3.4" ];
|
||||
}
|
||||
17
PI3/exports/ejercicio2a_1.dot
Normal file
17
PI3/exports/ejercicio2a_1.dot
Normal file
@@ -0,0 +1,17 @@
|
||||
strict graph G {
|
||||
1 [ color="black" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="black" label="Tombola" ];
|
||||
4 [ color="black" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="magenta" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="black" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="magenta" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="black" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
}
|
||||
31
PI3/exports/ejercicio2a_2.dot
Normal file
31
PI3/exports/ejercicio2a_2.dot
Normal file
@@ -0,0 +1,31 @@
|
||||
strict graph G {
|
||||
1 [ color="black" label="Barco Pirata" ];
|
||||
2 [ color="black" label="Casa del Terror" ];
|
||||
3 [ color="black" label="Tombola" ];
|
||||
4 [ color="black" label="Gusano Loco" ];
|
||||
5 [ color="black" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
7 [ color="black" label="Pim pam pum" ];
|
||||
8 [ color="black" label="Puesto de algodon" ];
|
||||
9 [ color="magenta" label="Noria" ];
|
||||
10 [ color="magenta" label="Patitos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="black" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="black" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="black" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
2 -- 8 [ color="black" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
4 -- 10 [ color="black" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="black" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="magenta" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="black" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="black" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="magenta" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
}
|
||||
37
PI3/exports/ejercicio2a_3.dot
Normal file
37
PI3/exports/ejercicio2a_3.dot
Normal file
@@ -0,0 +1,37 @@
|
||||
strict graph G {
|
||||
1 [ color="black" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="black" label="Tombola" ];
|
||||
4 [ color="black" label="Gusano Loco" ];
|
||||
5 [ color="black" label="Raton Vacilon" ];
|
||||
6 [ color="black" label="Coches de choque" ];
|
||||
7 [ color="magenta" label="Pim pam pum" ];
|
||||
8 [ color="magenta" label="Puesto de algodon" ];
|
||||
9 [ color="black" label="Noria" ];
|
||||
10 [ color="black" label="Patitos" ];
|
||||
11 [ color="black" label="Tren de la bruja" ];
|
||||
12 [ color="black" label="Casa de los espejos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="black" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="black" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="black" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
12 -- 5 [ color="black" label="20.0 km, 5.0 min" ];
|
||||
2 -- 8 [ color="magenta" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
11 -- 9 [ color="black" label="60.0 km, 6.0 min" ];
|
||||
4 -- 10 [ color="black" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="black" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="black" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="magenta" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="black" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="black" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 11 [ color="black" label="70.0 km, 4.5 min" ];
|
||||
4 -- 12 [ color="black" label="20.0 km, 2.5 min" ];
|
||||
}
|
||||
17
PI3/exports/ejercicio2b_1.dot
Normal file
17
PI3/exports/ejercicio2b_1.dot
Normal file
@@ -0,0 +1,17 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="magenta" label="Tombola" ];
|
||||
4 [ color="magenta" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="magenta" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="magenta" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="magenta" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="magenta" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="magenta" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="magenta" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
}
|
||||
31
PI3/exports/ejercicio2b_2.dot
Normal file
31
PI3/exports/ejercicio2b_2.dot
Normal file
@@ -0,0 +1,31 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="magenta" label="Tombola" ];
|
||||
4 [ color="magenta" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
7 [ color="magenta" label="Pim pam pum" ];
|
||||
8 [ color="magenta" label="Puesto de algodon" ];
|
||||
9 [ color="magenta" label="Noria" ];
|
||||
10 [ color="magenta" label="Patitos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="magenta" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="magenta" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="magenta" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="magenta" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="magenta" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
2 -- 8 [ color="black" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
4 -- 10 [ color="magenta" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="magenta" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="black" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="magenta" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="magenta" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="magenta" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
}
|
||||
37
PI3/exports/ejercicio2b_3.dot
Normal file
37
PI3/exports/ejercicio2b_3.dot
Normal file
@@ -0,0 +1,37 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="magenta" label="Tombola" ];
|
||||
4 [ color="magenta" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
7 [ color="magenta" label="Pim pam pum" ];
|
||||
8 [ color="magenta" label="Puesto de algodon" ];
|
||||
9 [ color="magenta" label="Noria" ];
|
||||
10 [ color="magenta" label="Patitos" ];
|
||||
11 [ color="magenta" label="Tren de la bruja" ];
|
||||
12 [ color="magenta" label="Casa de los espejos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="magenta" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="black" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="black" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="magenta" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="magenta" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="black" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
12 -- 5 [ color="magenta" label="20.0 km, 5.0 min" ];
|
||||
2 -- 8 [ color="magenta" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
11 -- 9 [ color="magenta" label="60.0 km, 6.0 min" ];
|
||||
4 -- 10 [ color="black" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="magenta" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="black" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="magenta" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="black" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="magenta" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="magenta" label="150.0 km, 2.0 min" ];
|
||||
6 -- 11 [ color="magenta" label="70.0 km, 4.5 min" ];
|
||||
4 -- 12 [ color="magenta" label="20.0 km, 2.5 min" ];
|
||||
}
|
||||
17
PI3/exports/ejercicio2c_1.dot
Normal file
17
PI3/exports/ejercicio2c_1.dot
Normal file
@@ -0,0 +1,17 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="magenta" label="Tombola" ];
|
||||
4 [ color="magenta" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="magenta" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="magenta" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="magenta" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="magenta" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="magenta" label="50.0 km, 3.0 min" ];
|
||||
}
|
||||
31
PI3/exports/ejercicio2c_2.dot
Normal file
31
PI3/exports/ejercicio2c_2.dot
Normal file
@@ -0,0 +1,31 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="black" label="Tombola" ];
|
||||
4 [ color="black" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
7 [ color="black" label="Pim pam pum" ];
|
||||
8 [ color="magenta" label="Puesto de algodon" ];
|
||||
9 [ color="black" label="Noria" ];
|
||||
10 [ color="black" label="Patitos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="magenta" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="magenta" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="black" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="magenta" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="black" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
2 -- 8 [ color="magenta" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
4 -- 10 [ color="black" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="black" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="black" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="black" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="black" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="black" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
}
|
||||
37
PI3/exports/ejercicio2c_3.dot
Normal file
37
PI3/exports/ejercicio2c_3.dot
Normal file
@@ -0,0 +1,37 @@
|
||||
strict graph G {
|
||||
1 [ color="magenta" label="Barco Pirata" ];
|
||||
2 [ color="magenta" label="Casa del Terror" ];
|
||||
3 [ color="black" label="Tombola" ];
|
||||
4 [ color="magenta" label="Gusano Loco" ];
|
||||
5 [ color="magenta" label="Raton Vacilon" ];
|
||||
6 [ color="magenta" label="Coches de choque" ];
|
||||
7 [ color="black" label="Pim pam pum" ];
|
||||
8 [ color="magenta" label="Puesto de algodon" ];
|
||||
9 [ color="black" label="Noria" ];
|
||||
10 [ color="black" label="Patitos" ];
|
||||
11 [ color="black" label="Tren de la bruja" ];
|
||||
12 [ color="magenta" label="Casa de los espejos" ];
|
||||
1 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
1 -- 3 [ color="black" label="100.0 km, 1.5 min" ];
|
||||
1 -- 5 [ color="magenta" label="150.0 km, 1.5 min" ];
|
||||
2 -- 5 [ color="black" label="50.0 km, 5.0 min" ];
|
||||
3 -- 4 [ color="black" label="30.0 km, 0.5 min" ];
|
||||
4 -- 5 [ color="black" label="40.0 km, 0.8 min" ];
|
||||
6 -- 2 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 1 [ color="magenta" label="100.0 km, 2.0 min" ];
|
||||
2 -- 4 [ color="magenta" label="50.0 km, 3.0 min" ];
|
||||
1 -- 7 [ color="black" label="120.0 km, 1.8 min" ];
|
||||
12 -- 5 [ color="magenta" label="20.0 km, 5.0 min" ];
|
||||
2 -- 8 [ color="magenta" label="80.0 km, 1.2 min" ];
|
||||
3 -- 9 [ color="black" label="90.0 km, 1.4 min" ];
|
||||
11 -- 9 [ color="black" label="60.0 km, 6.0 min" ];
|
||||
4 -- 10 [ color="black" label="60.0 km, 1.0 min" ];
|
||||
5 -- 7 [ color="black" label="130.0 km, 1.9 min" ];
|
||||
6 -- 9 [ color="black" label="110.0 km, 2.1 min" ];
|
||||
7 -- 8 [ color="black" label="40.0 km, 0.7 min" ];
|
||||
8 -- 9 [ color="black" label="50.0 km, 0.8 min" ];
|
||||
9 -- 10 [ color="black" label="70.0 km, 1.1 min" ];
|
||||
10 -- 1 [ color="black" label="150.0 km, 2.0 min" ];
|
||||
6 -- 11 [ color="black" label="70.0 km, 4.5 min" ];
|
||||
4 -- 12 [ color="magenta" label="20.0 km, 2.5 min" ];
|
||||
}
|
||||
24
PI3/exports/ejercicio3b_1.dot
Normal file
24
PI3/exports/ejercicio3b_1.dot
Normal file
@@ -0,0 +1,24 @@
|
||||
strict digraph G {
|
||||
1 [ color="magenta" label="Tarea1" ];
|
||||
2 [ color="magenta" label="Tarea2" ];
|
||||
3 [ color="magenta" label="Tarea3" ];
|
||||
4 [ color="magenta" label="Tarea4" ];
|
||||
5 [ color="magenta" label="Tarea5" ];
|
||||
6 [ color="black" label="Tarea6" ];
|
||||
7 [ color="black" label="Tarea7" ];
|
||||
8 [ color="black" label="Tarea8" ];
|
||||
9 [ color="black" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
1 -> 2 [ color="black" label="Relacion-64" ];
|
||||
1 -> 3 [ color="black" label="Relacion-65" ];
|
||||
2 -> 4 [ color="black" label="Relacion-66" ];
|
||||
3 -> 4 [ color="black" label="Relacion-67" ];
|
||||
4 -> 5 [ color="black" label="Relacion-68" ];
|
||||
4 -> 6 [ color="black" label="Relacion-69" ];
|
||||
5 -> 7 [ color="black" label="Relacion-70" ];
|
||||
6 -> 7 [ color="black" label="Relacion-71" ];
|
||||
7 -> 8 [ color="black" label="Relacion-72" ];
|
||||
2 -> 9 [ color="black" label="Relacion-73" ];
|
||||
9 -> 10 [ color="black" label="Relacion-74" ];
|
||||
3 -> 10 [ color="black" label="Relacion-75" ];
|
||||
}
|
||||
31
PI3/exports/ejercicio3b_2.dot
Normal file
31
PI3/exports/ejercicio3b_2.dot
Normal file
@@ -0,0 +1,31 @@
|
||||
strict digraph G {
|
||||
1 [ color="magenta" label="Tarea1" ];
|
||||
2 [ color="magenta" label="Tarea2" ];
|
||||
3 [ color="magenta" label="Tarea3" ];
|
||||
4 [ color="magenta" label="Tarea4" ];
|
||||
5 [ color="magenta" label="Tarea5" ];
|
||||
6 [ color="magenta" label="Tarea6" ];
|
||||
7 [ color="magenta" label="Tarea7" ];
|
||||
8 [ color="magenta" label="Tarea8" ];
|
||||
9 [ color="black" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
1 -> 4 [ color="black" label="Relacion-76" ];
|
||||
1 -> 5 [ color="black" label="Relacion-77" ];
|
||||
1 -> 9 [ color="black" label="Relacion-78" ];
|
||||
2 -> 4 [ color="black" label="Relacion-79" ];
|
||||
2 -> 6 [ color="black" label="Relacion-80" ];
|
||||
2 -> 8 [ color="black" label="Relacion-81" ];
|
||||
2 -> 9 [ color="black" label="Relacion-82" ];
|
||||
3 -> 4 [ color="black" label="Relacion-83" ];
|
||||
3 -> 10 [ color="black" label="Relacion-84" ];
|
||||
4 -> 5 [ color="black" label="Relacion-85" ];
|
||||
4 -> 6 [ color="black" label="Relacion-86" ];
|
||||
5 -> 7 [ color="black" label="Relacion-87" ];
|
||||
5 -> 9 [ color="black" label="Relacion-88" ];
|
||||
6 -> 7 [ color="black" label="Relacion-89" ];
|
||||
6 -> 8 [ color="black" label="Relacion-90" ];
|
||||
7 -> 8 [ color="black" label="Relacion-91" ];
|
||||
7 -> 9 [ color="black" label="Relacion-92" ];
|
||||
8 -> 10 [ color="black" label="Relacion-93" ];
|
||||
9 -> 10 [ color="black" label="Relacion-94" ];
|
||||
}
|
||||
50
PI3/exports/ejercicio3b_3.dot
Normal file
50
PI3/exports/ejercicio3b_3.dot
Normal file
@@ -0,0 +1,50 @@
|
||||
strict digraph G {
|
||||
1 [ color="magenta" label="Tarea1" ];
|
||||
2 [ color="magenta" label="Tarea2" ];
|
||||
3 [ color="magenta" label="Tarea3" ];
|
||||
4 [ color="magenta" label="Tarea4" ];
|
||||
5 [ color="magenta" label="Tarea5" ];
|
||||
6 [ color="magenta" label="Tarea6" ];
|
||||
7 [ color="magenta" label="Tarea7" ];
|
||||
8 [ color="magenta" label="Tarea8" ];
|
||||
9 [ color="magenta" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
11 [ color="magenta" label="Tarea11" ];
|
||||
12 [ color="magenta" label="Tarea12" ];
|
||||
13 [ color="magenta" label="Tarea13" ];
|
||||
14 [ color="magenta" label="Tarea14" ];
|
||||
15 [ color="magenta" label="Tarea15" ];
|
||||
1 -> 4 [ color="black" label="Relacion-95" ];
|
||||
1 -> 5 [ color="black" label="Relacion-96" ];
|
||||
1 -> 9 [ color="black" label="Relacion-97" ];
|
||||
2 -> 4 [ color="black" label="Relacion-98" ];
|
||||
2 -> 6 [ color="black" label="Relacion-99" ];
|
||||
2 -> 8 [ color="black" label="Relacion-100" ];
|
||||
2 -> 9 [ color="black" label="Relacion-101" ];
|
||||
3 -> 4 [ color="black" label="Relacion-102" ];
|
||||
3 -> 10 [ color="black" label="Relacion-103" ];
|
||||
4 -> 5 [ color="black" label="Relacion-104" ];
|
||||
4 -> 6 [ color="black" label="Relacion-105" ];
|
||||
5 -> 7 [ color="black" label="Relacion-106" ];
|
||||
5 -> 9 [ color="black" label="Relacion-107" ];
|
||||
6 -> 7 [ color="black" label="Relacion-108" ];
|
||||
6 -> 8 [ color="black" label="Relacion-109" ];
|
||||
7 -> 8 [ color="black" label="Relacion-110" ];
|
||||
7 -> 9 [ color="black" label="Relacion-111" ];
|
||||
8 -> 10 [ color="black" label="Relacion-112" ];
|
||||
9 -> 10 [ color="black" label="Relacion-113" ];
|
||||
1 -> 11 [ color="black" label="Relacion-114" ];
|
||||
12 -> 13 [ color="black" label="Relacion-115" ];
|
||||
13 -> 14 [ color="black" label="Relacion-116" ];
|
||||
14 -> 15 [ color="black" label="Relacion-117" ];
|
||||
15 -> 8 [ color="black" label="Relacion-118" ];
|
||||
11 -> 14 [ color="black" label="Relacion-119" ];
|
||||
12 -> 5 [ color="black" label="Relacion-120" ];
|
||||
9 -> 13 [ color="black" label="Relacion-121" ];
|
||||
13 -> 10 [ color="black" label="Relacion-122" ];
|
||||
14 -> 10 [ color="black" label="Relacion-123" ];
|
||||
2 -> 15 [ color="black" label="Relacion-124" ];
|
||||
5 -> 11 [ color="black" label="Relacion-125" ];
|
||||
3 -> 12 [ color="black" label="Relacion-126" ];
|
||||
6 -> 14 [ color="black" label="Relacion-127" ];
|
||||
}
|
||||
24
PI3/exports/ejercicio3c_1.dot
Normal file
24
PI3/exports/ejercicio3c_1.dot
Normal file
@@ -0,0 +1,24 @@
|
||||
strict digraph G {
|
||||
1 [ color="magenta" label="Tarea1" ];
|
||||
2 [ color="black" label="Tarea2" ];
|
||||
3 [ color="black" label="Tarea3" ];
|
||||
4 [ color="black" label="Tarea4" ];
|
||||
5 [ color="black" label="Tarea5" ];
|
||||
6 [ color="black" label="Tarea6" ];
|
||||
7 [ color="black" label="Tarea7" ];
|
||||
8 [ color="black" label="Tarea8" ];
|
||||
9 [ color="black" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
1 -> 2 [ color="black" label="Relacion-128" ];
|
||||
1 -> 3 [ color="black" label="Relacion-129" ];
|
||||
2 -> 4 [ color="black" label="Relacion-130" ];
|
||||
3 -> 4 [ color="black" label="Relacion-131" ];
|
||||
4 -> 5 [ color="black" label="Relacion-132" ];
|
||||
4 -> 6 [ color="black" label="Relacion-133" ];
|
||||
5 -> 7 [ color="black" label="Relacion-134" ];
|
||||
6 -> 7 [ color="black" label="Relacion-135" ];
|
||||
7 -> 8 [ color="black" label="Relacion-136" ];
|
||||
2 -> 9 [ color="black" label="Relacion-137" ];
|
||||
9 -> 10 [ color="black" label="Relacion-138" ];
|
||||
3 -> 10 [ color="black" label="Relacion-139" ];
|
||||
}
|
||||
31
PI3/exports/ejercicio3c_2.dot
Normal file
31
PI3/exports/ejercicio3c_2.dot
Normal file
@@ -0,0 +1,31 @@
|
||||
strict digraph G {
|
||||
1 [ color="magenta" label="Tarea1" ];
|
||||
2 [ color="magenta" label="Tarea2" ];
|
||||
3 [ color="magenta" label="Tarea3" ];
|
||||
4 [ color="black" label="Tarea4" ];
|
||||
5 [ color="black" label="Tarea5" ];
|
||||
6 [ color="black" label="Tarea6" ];
|
||||
7 [ color="black" label="Tarea7" ];
|
||||
8 [ color="black" label="Tarea8" ];
|
||||
9 [ color="black" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
1 -> 4 [ color="black" label="Relacion-140" ];
|
||||
1 -> 5 [ color="black" label="Relacion-141" ];
|
||||
1 -> 9 [ color="black" label="Relacion-142" ];
|
||||
2 -> 4 [ color="black" label="Relacion-143" ];
|
||||
2 -> 6 [ color="black" label="Relacion-144" ];
|
||||
2 -> 8 [ color="black" label="Relacion-145" ];
|
||||
2 -> 9 [ color="black" label="Relacion-146" ];
|
||||
3 -> 4 [ color="black" label="Relacion-147" ];
|
||||
3 -> 10 [ color="black" label="Relacion-148" ];
|
||||
4 -> 5 [ color="black" label="Relacion-149" ];
|
||||
4 -> 6 [ color="black" label="Relacion-150" ];
|
||||
5 -> 7 [ color="black" label="Relacion-151" ];
|
||||
5 -> 9 [ color="black" label="Relacion-152" ];
|
||||
6 -> 7 [ color="black" label="Relacion-153" ];
|
||||
6 -> 8 [ color="black" label="Relacion-154" ];
|
||||
7 -> 8 [ color="black" label="Relacion-155" ];
|
||||
7 -> 9 [ color="black" label="Relacion-156" ];
|
||||
8 -> 10 [ color="black" label="Relacion-157" ];
|
||||
9 -> 10 [ color="black" label="Relacion-158" ];
|
||||
}
|
||||
50
PI3/exports/ejercicio3c_3.dot
Normal file
50
PI3/exports/ejercicio3c_3.dot
Normal file
@@ -0,0 +1,50 @@
|
||||
strict digraph G {
|
||||
1 [ color="black" label="Tarea1" ];
|
||||
2 [ color="black" label="Tarea2" ];
|
||||
3 [ color="magenta" label="Tarea3" ];
|
||||
4 [ color="black" label="Tarea4" ];
|
||||
5 [ color="black" label="Tarea5" ];
|
||||
6 [ color="black" label="Tarea6" ];
|
||||
7 [ color="black" label="Tarea7" ];
|
||||
8 [ color="black" label="Tarea8" ];
|
||||
9 [ color="black" label="Tarea9" ];
|
||||
10 [ color="black" label="Tarea10" ];
|
||||
11 [ color="black" label="Tarea11" ];
|
||||
12 [ color="black" label="Tarea12" ];
|
||||
13 [ color="black" label="Tarea13" ];
|
||||
14 [ color="black" label="Tarea14" ];
|
||||
15 [ color="black" label="Tarea15" ];
|
||||
1 -> 4 [ color="black" label="Relacion-159" ];
|
||||
1 -> 5 [ color="black" label="Relacion-160" ];
|
||||
1 -> 9 [ color="black" label="Relacion-161" ];
|
||||
2 -> 4 [ color="black" label="Relacion-162" ];
|
||||
2 -> 6 [ color="black" label="Relacion-163" ];
|
||||
2 -> 8 [ color="black" label="Relacion-164" ];
|
||||
2 -> 9 [ color="black" label="Relacion-165" ];
|
||||
3 -> 4 [ color="black" label="Relacion-166" ];
|
||||
3 -> 10 [ color="black" label="Relacion-167" ];
|
||||
4 -> 5 [ color="black" label="Relacion-168" ];
|
||||
4 -> 6 [ color="black" label="Relacion-169" ];
|
||||
5 -> 7 [ color="black" label="Relacion-170" ];
|
||||
5 -> 9 [ color="black" label="Relacion-171" ];
|
||||
6 -> 7 [ color="black" label="Relacion-172" ];
|
||||
6 -> 8 [ color="black" label="Relacion-173" ];
|
||||
7 -> 8 [ color="black" label="Relacion-174" ];
|
||||
7 -> 9 [ color="black" label="Relacion-175" ];
|
||||
8 -> 10 [ color="black" label="Relacion-176" ];
|
||||
9 -> 10 [ color="black" label="Relacion-177" ];
|
||||
1 -> 11 [ color="black" label="Relacion-178" ];
|
||||
12 -> 13 [ color="black" label="Relacion-179" ];
|
||||
13 -> 14 [ color="black" label="Relacion-180" ];
|
||||
14 -> 15 [ color="black" label="Relacion-181" ];
|
||||
15 -> 8 [ color="black" label="Relacion-182" ];
|
||||
11 -> 14 [ color="black" label="Relacion-183" ];
|
||||
12 -> 5 [ color="black" label="Relacion-184" ];
|
||||
9 -> 13 [ color="black" label="Relacion-185" ];
|
||||
13 -> 10 [ color="black" label="Relacion-186" ];
|
||||
14 -> 10 [ color="black" label="Relacion-187" ];
|
||||
2 -> 15 [ color="black" label="Relacion-188" ];
|
||||
5 -> 11 [ color="black" label="Relacion-189" ];
|
||||
3 -> 12 [ color="black" label="Relacion-190" ];
|
||||
6 -> 14 [ color="black" label="Relacion-191" ];
|
||||
}
|
||||
43
PI3/ficheros/ejercicio1_1.txt
Normal file
43
PI3/ficheros/ejercicio1_1.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
#VERTEX#
|
||||
Diana, 4.6, [Fotografia;Cocina;Docencia;Jardineria;Lectura]
|
||||
Guti, 4.2, [Ciclismo;Lectura;Programacion;Conciertos;Ajedrez]
|
||||
David, 4.7, [Programacion;Docencia;Ilusionismo;Cine;Escritura]
|
||||
Miguel, 4.8, [Conciertos;Ajedrez;Jardineria;Videojuegos;Baile]
|
||||
Belen, 4.5, [Ilusionismo;Cine;Fotografia;Cocina;Ciclismo]
|
||||
Rafael, 4.3, [Jardineria;Videojuegos;Programacion;Conciertos;Lectura]
|
||||
Paco, 4.1, [Docencia;Videojuegos;Cocina;Fotografia;Lectura]
|
||||
Elena, 4.9, [Escritura;Baile;Docencia;Ilusionismo;Cine]
|
||||
Fernando, 4.1, [Lectura;Docencia;Cocina;Jardineria;Programacion]
|
||||
Irene, 4.2, [Cine;Programacion;Conciertos;Ajedrez;Ilusionismo]
|
||||
Antonio, 4.4, [Videojuegos;Baile;Fotografia;Ciclismo;Escritura]
|
||||
Maria, 4.5, [Cine;Ilusionismo;Docencia;Lectura;Cocina]
|
||||
Laura, 4.6, [Fotografía; Música; Programación; Ajedrez; Cocina]
|
||||
Carlos, 4.4, [Jardinería; Ciclismo; Lectura; Cine; Programación]
|
||||
Sara, 4.5, [Cocina; Baile; Fotografía; Jardinería; Lectura]
|
||||
#EDGE#
|
||||
Guti, Belen, 4.0
|
||||
Diana, David, 3.7
|
||||
David, Miguel, 4.2
|
||||
Belen, Diana, 3.8
|
||||
Diana, Maria, 4.1
|
||||
Irene, Belen, 4.3
|
||||
Guti, David, 3.8
|
||||
Guti, Elena, 2.7
|
||||
Guti, Maria, 3.1
|
||||
Antonio, Maria, 4.5
|
||||
Guti, Fernando, 1.8
|
||||
Miguel, Belen, 3.9
|
||||
Belen, Paco, 4.0
|
||||
Belen, Maria, 3.0
|
||||
Rafael, David, 3.6
|
||||
Elena, Belen, 4.2
|
||||
Belen, David, 3.5
|
||||
Irene, Antonio, 4.0
|
||||
Paco, Miguel, 5
|
||||
Antonio, Belen, 4.3
|
||||
Maria, Fernando, 3.8
|
||||
Irene, David, 4.1
|
||||
Elena, Maria, 3.2
|
||||
Laura, Carlos, 4.0
|
||||
Carlos, Sara, 3.9
|
||||
Sara, Laura, 4.2
|
||||
60
PI3/ficheros/ejercicio1_2.txt
Normal file
60
PI3/ficheros/ejercicio1_2.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
#VERTEX#
|
||||
Diana, 4.8, [Fotografia;Cocina;Docencia;Jardineria;Lectura]
|
||||
Guti, 4.5, [Ciclismo;Lectura;Programacion;Conciertos;Ajedrez]
|
||||
David, 4.2, [Programacion;Docencia;Ilusionismo;Cine;Escritura]
|
||||
Miguel, 4.4, [Conciertos;Ajedrez;Jardineria;Videojuegos;Baile]
|
||||
Belen, 4.6, [Ilusionismo;Cine;Fotografia;Cocina;Ciclismo]
|
||||
Rafael, 4.7, [Jardineria;Videojuegos;Programacion;Conciertos;Lectura]
|
||||
Paco, 4.3, [Docencia;Videojuegos;Cocina;Fotografia;Lectura]
|
||||
Elena, 4.1, [Escritura;Baile;Docencia;Ilusionismo;Cine]
|
||||
Fernando, 4.2, [Lectura;Docencia;Cocina;Jardineria;Programacion]
|
||||
Irene, 4.1, [Cine;Programacion;Conciertos;Ajedrez;Ilusionismo]
|
||||
Antonio, 4.3, [Videojuegos;Baile;Fotografia;Ciclismo;Escritura]
|
||||
Maria, 4.4, [Cine;Ilusionismo;Docencia;Lectura;Cocina]
|
||||
Carlos, 4.1, [Musica;Fotografia;Viajes;Gastronomia;Teatro]
|
||||
Daniel, 4.6, [Yoga;Lectura;Pintura;Escalada;Cine]
|
||||
Javier, 4.2, [Golf;Programacion;Ciclismo;Ajedrez;Fotografia]
|
||||
Maria del Mar, 4.7, [Teatro;Baile;Escritura;Cocina;Jardineria]
|
||||
Carmelo, 4.5, [Videojuegos;Musica;Cine;Lectura;Escalada]
|
||||
Luis, 4.6, [Teatro; Música; Escritura; Yoga; Cocina]
|
||||
Ana, 4.5, [Pintura; Lectura; Jardinería; Ciclismo; Escalada]
|
||||
Roberto, 4.4, [Ajedrez; Programación; Cine; Viajes; Fotografía]
|
||||
Sofía, 4.7, [Baile; Teatro; Lectura; Música; Cocina]
|
||||
#EDGE#
|
||||
Diana, Guti, 3.9
|
||||
Diana, Daniel, 3.7
|
||||
Diana, Javier, 4.1
|
||||
Diana, Maria del Mar, 4.0
|
||||
Daniel, Guti, 4.1
|
||||
Daniel, Elena, 3.5
|
||||
Daniel, Maria, 4.2
|
||||
Daniel, Irene, 4.3
|
||||
Javier, Guti, 4.0
|
||||
Javier, Elena, 3.9
|
||||
Javier, Maria, 4.1
|
||||
Javier, Irene, 4.0
|
||||
Maria del Mar, Guti, 4.2
|
||||
Maria del Mar, Elena, 3.8
|
||||
Maria del Mar, David, 4.1
|
||||
Maria del Mar, Miguel, 4.3
|
||||
Carlos, Elena, 3.8
|
||||
Carmelo, Elena, 3.9
|
||||
David, Javier, 4.0
|
||||
Belen, Maria del Mar, 3.9
|
||||
Irene, Daniel, 4.1
|
||||
Guti, Maria, 4.0
|
||||
Antonio, Carmelo, 4.2
|
||||
Guti, Fernando, 3.0
|
||||
David, Miguel, 3.9
|
||||
Miguel, Maria del Mar, 4.0
|
||||
Belen, Paco, 4.1
|
||||
Rafael, Javier, 4.1
|
||||
Elena, Daniel, 4.3
|
||||
Belen, David, 4.2
|
||||
Paco, Carmelo, 4.5
|
||||
Maria, Carlos, 4.1
|
||||
Elena, Carmelo, 3.4
|
||||
Luis, Ana, 4.0
|
||||
Ana, Roberto, 3.9
|
||||
Roberto, Sofía, 4.1
|
||||
Sofía, Luis, 4.2
|
||||
50
PI3/ficheros/ejercicio1_3.txt
Normal file
50
PI3/ficheros/ejercicio1_3.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
#VERTEX#
|
||||
Diana, 4.8, [Fotografia;Cocina;Docencia;Jardineria;Lectura]
|
||||
Guti, 4.5, [Ciclismo;Lectura;Programacion;Conciertos;Ajedrez]
|
||||
David, 4.2, [Programacion;Docencia;Ilusionismo;Cine;Escritura]
|
||||
Miguel, 4.4, [Conciertos;Ajedrez;Jardineria;Videojuegos;Baile]
|
||||
Belen, 4.6, [Ilusionismo;Cine;Fotografia;Cocina;Ciclismo]
|
||||
Rafael, 4.7, [Jardineria;Videojuegos;Programacion;Conciertos;Lectura]
|
||||
Paco, 4.3, [Docencia;Videojuegos;Cocina;Fotografia;Lectura]
|
||||
Elena, 4.1, [Escritura;Baile;Docencia;Ilusionismo;Cine]
|
||||
Fernando, 4.2, [Lectura;Docencia;Cocina;Jardineria;Programacion]
|
||||
Irene, 4.1, [Cine;Programacion;Conciertos;Ajedrez;Ilusionismo]
|
||||
Antonio, 4.3, [Videojuegos;Baile;Fotografia;Ciclismo;Escritura]
|
||||
Maria, 4.4, [Cine;Ilusionismo;Docencia;Lectura;Cocina]
|
||||
Carlos, 4.1, [Musica;Fotografia;Viajes;Gastronomia;Teatro]
|
||||
Daniel, 4.6, [Yoga;Lectura;Pintura;Escalada;Cine]
|
||||
Javier, 4.2, [Golf;Programacion;Ciclismo;Ajedrez;Fotografia]
|
||||
Maria del Mar, 4.7, [Teatro;Baile;Escritura;Cocina;Jardineria]
|
||||
Carmelo, 4.5, [Videojuegos;Musica;Cine;Lectura;Escalada]
|
||||
#EDGE#
|
||||
Diana, Guti, 3.9
|
||||
Diana, Daniel, 3.7
|
||||
Diana, Javier, 4.1
|
||||
Diana, Maria del Mar, 4.2
|
||||
Guti, Maria, 4.0
|
||||
Guti, David, 4.1
|
||||
Guti, Miguel, 3.6
|
||||
Guti, Irene, 3.8
|
||||
Daniel, Elena, 3.5
|
||||
Daniel, Irene, 4.3
|
||||
Daniel, Carlos, 3.6
|
||||
Daniel, Carmelo, 3.7
|
||||
Maria del Mar, Guti, 4.2
|
||||
Maria del Mar, David, 4.1
|
||||
Maria del Mar, Rafael, 4.0
|
||||
Maria del Mar, Antonio, 4.3
|
||||
Irene, Daniel, 4.1
|
||||
Irene, Carlos, 3.9
|
||||
Irene, Carmelo, 4.0
|
||||
Irene, Paco, 3.8
|
||||
Javier, Miguel, 4.0
|
||||
Miguel, Maria del Mar, 4.0
|
||||
Carlos, Elena, 3.8
|
||||
Carmelo, Elena, 3.9
|
||||
Belen, Maria del Mar, 3.9
|
||||
Antonio, Carmelo, 4.2
|
||||
Elena, Daniel, 4.3
|
||||
Paco, Carmelo, 4.5
|
||||
Maria, Carlos, 4.1
|
||||
Elena, Carmelo, 3.4
|
||||
|
||||
17
PI3/ficheros/ejercicio2_1.txt
Normal file
17
PI3/ficheros/ejercicio2_1.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
#VERTEX#
|
||||
Barco Pirata, 30, 8.5, 5
|
||||
Casa del Terror, 20, 7.0, 10
|
||||
Tombola, 15, 6.5, 15
|
||||
Gusano Loco, 10, 5.0, 3
|
||||
Raton Vacilon, 25, 7.5, 7
|
||||
Coches de choque, 10, 9.5, 7
|
||||
#EDGE#
|
||||
Barco Pirata, Casa del Terror, 150, 2.0
|
||||
Barco Pirata, Tombola, 100, 1.5
|
||||
Barco Pirata, Raton Vacilon, 150, 1.5
|
||||
Casa del Terror, Raton Vacilon, 50, 5
|
||||
Tombola, Gusano Loco, 30, 0.5
|
||||
Gusano Loco, Raton Vacilon, 40, 0.8
|
||||
Coches de choque, Casa del Terror, 150, 2.0
|
||||
Coches de choque,Barco Pirata, 100, 2.0
|
||||
Casa del Terror,Gusano Loco, 50, 3.0
|
||||
31
PI3/ficheros/ejercicio2_2.txt
Normal file
31
PI3/ficheros/ejercicio2_2.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
#VERTEX#
|
||||
Barco Pirata, 30, 8.5, 5
|
||||
Casa del Terror, 20, 7.0, 10
|
||||
Tombola, 15, 6.5, 15
|
||||
Gusano Loco, 10, 5.0, 3
|
||||
Raton Vacilon, 25, 7.5, 7
|
||||
Coches de choque, 10, 9.5, 7
|
||||
Pim pam pum, 15, 6.0, 4
|
||||
Puesto de algodon, 5, 7.5, 2
|
||||
Noria, 20, 8.0, 5
|
||||
Patitos, 10, 5.5, 3
|
||||
#EDGE#
|
||||
Barco Pirata, Casa del Terror, 150, 2.0
|
||||
Barco Pirata, Tombola, 100, 1.5
|
||||
Barco Pirata, Raton Vacilon, 150, 1.5
|
||||
Casa del Terror, Raton Vacilon, 50, 5
|
||||
Tombola, Gusano Loco, 30, 0.5
|
||||
Gusano Loco, Raton Vacilon, 40, 0.8
|
||||
Coches de choque, Casa del Terror, 150, 2.0
|
||||
Coches de choque,Barco Pirata, 100, 2.0
|
||||
Casa del Terror,Gusano Loco, 50, 3.0
|
||||
Barco Pirata, Pim pam pum, 120, 1.8
|
||||
Casa del Terror, Puesto de algodon, 80, 1.2
|
||||
Tombola, Noria, 90, 1.4
|
||||
Gusano Loco, Patitos, 60, 1.0
|
||||
Raton Vacilon, Pim pam pum, 130, 1.9
|
||||
Coches de choque, Noria, 110, 2.1
|
||||
Pim pam pum, Puesto de algodon, 40, 0.7
|
||||
Puesto de algodon, Noria, 50, 0.8
|
||||
Noria, Patitos, 70, 1.1
|
||||
Patitos, Barco Pirata, 150, 2.0
|
||||
37
PI3/ficheros/ejercicio2_3.txt
Normal file
37
PI3/ficheros/ejercicio2_3.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
#VERTEX#
|
||||
Barco Pirata, 30, 8.5, 5
|
||||
Casa del Terror, 20, 7.0, 10
|
||||
Tombola, 15, 6.5, 15
|
||||
Gusano Loco, 10, 5.0, 3
|
||||
Raton Vacilon, 25, 7.5, 7
|
||||
Coches de choque, 10, 9.5, 7
|
||||
Pim pam pum, 15, 6.0, 4
|
||||
Puesto de algodon, 5, 7.5, 2
|
||||
Noria, 20, 8.0, 5
|
||||
Patitos, 10, 5.5, 3
|
||||
Tren de la bruja, 22, 7.5, 7
|
||||
Casa de los espejos, 17, 9, 9
|
||||
#EDGE#
|
||||
Barco Pirata, Casa del Terror, 150, 2.0
|
||||
Barco Pirata, Tombola, 100, 1.5
|
||||
Barco Pirata, Raton Vacilon, 150, 1.5
|
||||
Casa del Terror, Raton Vacilon, 50, 5
|
||||
Tombola, Gusano Loco, 30, 0.5
|
||||
Gusano Loco, Raton Vacilon, 40, 0.8
|
||||
Coches de choque, Casa del Terror, 150, 2.0
|
||||
Coches de choque,Barco Pirata, 100, 2.0
|
||||
Casa del Terror,Gusano Loco, 50, 3.0
|
||||
Barco Pirata, Pim pam pum, 120, 1.8
|
||||
Casa de los espejos, Raton Vacilon, 20, 5
|
||||
Casa del Terror, Puesto de algodon, 80, 1.2
|
||||
Tombola, Noria, 90, 1.4
|
||||
Tren de la bruja, Noria, 60, 6
|
||||
Gusano Loco, Patitos, 60, 1.0
|
||||
Raton Vacilon, Pim pam pum, 130, 1.9
|
||||
Coches de choque, Noria, 110, 2.1
|
||||
Pim pam pum, Puesto de algodon, 40, 0.7
|
||||
Puesto de algodon, Noria, 50, 0.8
|
||||
Noria, Patitos, 70, 1.1
|
||||
Patitos, Barco Pirata, 150, 2.0
|
||||
Coches de choque,Tren de la bruja, 70, 4.5
|
||||
Gusano Loco, Casa de los espejos, 20, 2.5
|
||||
24
PI3/ficheros/ejercicio3_1.txt
Normal file
24
PI3/ficheros/ejercicio3_1.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
#VERTEX#
|
||||
Tarea1
|
||||
Tarea2
|
||||
Tarea3
|
||||
Tarea4
|
||||
Tarea5
|
||||
Tarea6
|
||||
Tarea7
|
||||
Tarea8
|
||||
Tarea9
|
||||
Tarea10
|
||||
#EDGE#
|
||||
Tarea1, Tarea2
|
||||
Tarea1, Tarea3
|
||||
Tarea2, Tarea4
|
||||
Tarea3, Tarea4
|
||||
Tarea4, Tarea5
|
||||
Tarea4, Tarea6
|
||||
Tarea5, Tarea7
|
||||
Tarea6, Tarea7
|
||||
Tarea7, Tarea8
|
||||
Tarea2, Tarea9
|
||||
Tarea9, Tarea10
|
||||
Tarea3, Tarea10
|
||||
31
PI3/ficheros/ejercicio3_2.txt
Normal file
31
PI3/ficheros/ejercicio3_2.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
#VERTEX#
|
||||
Tarea1
|
||||
Tarea2
|
||||
Tarea3
|
||||
Tarea4
|
||||
Tarea5
|
||||
Tarea6
|
||||
Tarea7
|
||||
Tarea8
|
||||
Tarea9
|
||||
Tarea10
|
||||
#EDGE#
|
||||
Tarea1, Tarea4
|
||||
Tarea1, Tarea5
|
||||
Tarea1, Tarea9
|
||||
Tarea2, Tarea4
|
||||
Tarea2, Tarea6
|
||||
Tarea2, Tarea8
|
||||
Tarea2, Tarea9
|
||||
Tarea3, Tarea4
|
||||
Tarea3, Tarea10
|
||||
Tarea4, Tarea5
|
||||
Tarea4, Tarea6
|
||||
Tarea5, Tarea7
|
||||
Tarea5, Tarea9
|
||||
Tarea6, Tarea7
|
||||
Tarea6, Tarea8
|
||||
Tarea7, Tarea8
|
||||
Tarea7, Tarea9
|
||||
Tarea8, Tarea10
|
||||
Tarea9, Tarea10
|
||||
50
PI3/ficheros/ejercicio3_3.txt
Normal file
50
PI3/ficheros/ejercicio3_3.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
#VERTEX#
|
||||
Tarea1
|
||||
Tarea2
|
||||
Tarea3
|
||||
Tarea4
|
||||
Tarea5
|
||||
Tarea6
|
||||
Tarea7
|
||||
Tarea8
|
||||
Tarea9
|
||||
Tarea10
|
||||
Tarea11
|
||||
Tarea12
|
||||
Tarea13
|
||||
Tarea14
|
||||
Tarea15
|
||||
#EDGE#
|
||||
Tarea1, Tarea4
|
||||
Tarea1, Tarea5
|
||||
Tarea1, Tarea9
|
||||
Tarea2, Tarea4
|
||||
Tarea2, Tarea6
|
||||
Tarea2, Tarea8
|
||||
Tarea2, Tarea9
|
||||
Tarea3, Tarea4
|
||||
Tarea3, Tarea10
|
||||
Tarea4, Tarea5
|
||||
Tarea4, Tarea6
|
||||
Tarea5, Tarea7
|
||||
Tarea5, Tarea9
|
||||
Tarea6, Tarea7
|
||||
Tarea6, Tarea8
|
||||
Tarea7, Tarea8
|
||||
Tarea7, Tarea9
|
||||
Tarea8, Tarea10
|
||||
Tarea9, Tarea10
|
||||
Tarea1, Tarea11
|
||||
Tarea12, Tarea13
|
||||
Tarea13, Tarea14
|
||||
Tarea14, Tarea15
|
||||
Tarea15, Tarea8
|
||||
Tarea11, Tarea14
|
||||
Tarea12, Tarea5
|
||||
Tarea9, Tarea13
|
||||
Tarea13, Tarea10
|
||||
Tarea14, Tarea10
|
||||
Tarea2, Tarea15
|
||||
Tarea5, Tarea11
|
||||
Tarea3, Tarea12
|
||||
Tarea6, Tarea14
|
||||
20
PI3/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
20
PI3/src/main/java/adda/ejercicios/Ejercicio1.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.jgrapht.Graph;
|
||||
|
||||
import us.lsi.graphs.views.SubGraphView;
|
||||
|
||||
public class Ejercicio1 {
|
||||
public static <V,E> Graph<V,E> ejercicio1(Graph<V,E> g, Predicate<V> condV, Predicate<E> condE) {
|
||||
Graph<V,E> subG = SubGraphView.of(g, condV, condE);
|
||||
return subG;
|
||||
}
|
||||
|
||||
public static <V,E> Graph<V,E> ejercicio1Alt(Graph<V,E> g, Set<V> s) {
|
||||
Graph<V,E> subG = SubGraphView.of(g, s);
|
||||
return subG;
|
||||
}
|
||||
}
|
||||
15
PI3/src/main/java/adda/ejercicios/Ejercicio2.java
Normal file
15
PI3/src/main/java/adda/ejercicios/Ejercicio2.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package adda.ejercicios;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jgrapht.Graph;
|
||||
import org.jgrapht.GraphPath;
|
||||
|
||||
import us.lsi.graphs.views.SubGraphView;
|
||||
|
||||
public class Ejercicio2 {
|
||||
public static <V, E> Graph<V, E> ejercicio2(Graph<V, E> g, GraphPath<V, E> caminoMinimo) {
|
||||
Graph<V, E> subG = SubGraphView.of(g, caminoMinimo.getVertexList().stream().collect(Collectors.toSet()));
|
||||
return subG;
|
||||
}
|
||||
}
|
||||
170
PI3/src/main/java/adda/tests/Test1.java
Normal file
170
PI3/src/main/java/adda/tests/Test1.java
Normal file
@@ -0,0 +1,170 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jgrapht.Graph;
|
||||
import org.jgrapht.alg.connectivity.ConnectivityInspector;
|
||||
import org.jgrapht.alg.interfaces.VertexCoverAlgorithm;
|
||||
import org.jgrapht.alg.interfaces.VertexCoverAlgorithm.VertexCover;
|
||||
import org.jgrapht.alg.vertexcover.GreedyVCImpl;
|
||||
import org.jgrapht.graph.AsUndirectedGraph;
|
||||
import org.jgrapht.graph.SimpleDirectedWeightedGraph;
|
||||
|
||||
import adda.ejercicios.Ejercicio1;
|
||||
import adda.util.Interaccion;
|
||||
import adda.util.Usuario;
|
||||
import us.lsi.colors.GraphColors;
|
||||
import us.lsi.colors.GraphColors.Color;
|
||||
import us.lsi.common.Map2;
|
||||
import us.lsi.graphs.Graphs2;
|
||||
import us.lsi.graphs.GraphsReader;
|
||||
|
||||
public class Test1 {
|
||||
private static int nEj1 = 1;
|
||||
public static void apartadoA(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio1_"+nEj1);
|
||||
SimpleDirectedWeightedGraph<Usuario, Interaccion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Usuario::ofFormat,
|
||||
Interaccion::ofFormat,
|
||||
() -> Graphs2.simpleDirectedWeightedGraph(),
|
||||
a -> a.indiceInteraccion()
|
||||
);
|
||||
Graph<Usuario, Interaccion> g2 = Ejercicio1.ejercicio1(
|
||||
g,
|
||||
v -> g.outDegreeOf(v) > 3,
|
||||
e -> e.indiceInteraccion() > 2.5
|
||||
);
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio1a_" + nEj1 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.indiceInteraccion().toString(),
|
||||
v -> GraphColors.colorIf(Color.blue, Color.black, g2.containsVertex(v)),
|
||||
e -> GraphColors.colorIf(Color.blue, Color.black, g2.containsEdge(e))
|
||||
);
|
||||
nEj1++;
|
||||
System.out.println(" "+g2);
|
||||
}
|
||||
|
||||
public static void apartadoB(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio1_"+nEj1);
|
||||
SimpleDirectedWeightedGraph<Usuario, Interaccion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Usuario::ofFormat,
|
||||
Interaccion::ofFormat,
|
||||
() -> Graphs2.simpleDirectedWeightedGraph(),
|
||||
a -> a.indiceInteraccion()
|
||||
);
|
||||
ConnectivityInspector<Usuario, Interaccion> connIns = new ConnectivityInspector<>(g);
|
||||
List<Set<Usuario>> connectedSets = connIns.connectedSets();
|
||||
for (Set<Usuario> group : connectedSets) {
|
||||
System.out.println(" "+ group);
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio1b_" + nEj1 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.indiceInteraccion().toString(),
|
||||
v -> GraphColors.colorIf(Color.red, Color.blue, group.contains(v)),
|
||||
e -> GraphColors.colorIf(Color.red, Color.blue, group.contains(g.getEdgeSource(e)) && group.contains(g.getEdgeTarget(e)))
|
||||
);
|
||||
}
|
||||
nEj1++;
|
||||
}
|
||||
|
||||
public static void apartadoC(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio1_"+nEj1);
|
||||
SimpleDirectedWeightedGraph<Usuario, Interaccion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Usuario::ofFormat,
|
||||
Interaccion::ofFormat,
|
||||
() -> Graphs2.simpleDirectedWeightedGraph(),
|
||||
a -> a.indiceInteraccion()
|
||||
);
|
||||
|
||||
Graph<Usuario, Interaccion> undirectedGraph = new AsUndirectedGraph<>(g);
|
||||
VertexCoverAlgorithm<Usuario> vc = new GreedyVCImpl<Usuario, Interaccion>(undirectedGraph,Map2.of(x->x.indiceActividad()));
|
||||
VertexCover<Usuario> vertexCover = vc.getVertexCover();
|
||||
|
||||
// Imprimir el conjunto mínimo de usuarios
|
||||
System.out.println(" "+vertexCover);
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio1c_" + nEj1 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.indiceInteraccion().toString(),
|
||||
v -> GraphColors.colorIf(Color.red, Color.black, vertexCover.contains(v)),
|
||||
e -> GraphColors.color(Color.black)
|
||||
|
||||
);
|
||||
nEj1++;
|
||||
}
|
||||
|
||||
public static void apartadoD(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio1_"+nEj1);
|
||||
SimpleDirectedWeightedGraph<Usuario, Interaccion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Usuario::ofFormat,
|
||||
Interaccion::ofFormat,
|
||||
() -> Graphs2.simpleDirectedWeightedGraph(),
|
||||
a -> a.indiceInteraccion()
|
||||
);
|
||||
|
||||
Predicate<Usuario> p = u ->
|
||||
g.inDegreeOf(u)>=5 && u.aficiones().size()>3 &&
|
||||
u.indiceActividad()>4;
|
||||
|
||||
Graph<Usuario,Interaccion> g2 = Ejercicio1.ejercicio1Alt(
|
||||
g,
|
||||
g.vertexSet().stream()
|
||||
.filter(p)
|
||||
.sorted((u1,u2)-> calcularMedia(u2,g.incomingEdgesOf(u2))
|
||||
.compareTo(calcularMedia(u1,g.incomingEdgesOf(u1))))
|
||||
.limit(2)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio1d_" + nEj1 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.indiceInteraccion().toString(),
|
||||
v -> GraphColors.colorIf(Color.red, Color.black, g2.containsVertex(v)),
|
||||
e -> GraphColors.color(Color.black)
|
||||
|
||||
);
|
||||
nEj1++;
|
||||
System.out.println(" "+g2);
|
||||
}
|
||||
|
||||
private static Double calcularMedia(Usuario u, Set<Interaccion> s) {
|
||||
List<Double> aux = s.stream().map(Interaccion::indiceInteraccion).toList();
|
||||
return aux.stream().reduce((d1,d2) -> d1+d2).orElse(0.)/aux.size();
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
System.out.println("--------- EJERCICIO 1 ---------\n=== APARTADO A ===");
|
||||
apartadoA("./ficheros/ejercicio1_1.txt");
|
||||
apartadoA("./ficheros/ejercicio1_2.txt");
|
||||
apartadoA("./ficheros/ejercicio1_3.txt");
|
||||
nEj1=1;
|
||||
System.out.println("\n=== APARTADO B ===");
|
||||
apartadoB("./ficheros/ejercicio1_1.txt");
|
||||
apartadoB("./ficheros/ejercicio1_2.txt");
|
||||
apartadoB("./ficheros/ejercicio1_3.txt");
|
||||
nEj1=1;
|
||||
System.out.println("\n=== APARTADO C ===");
|
||||
apartadoC("./ficheros/ejercicio1_1.txt");
|
||||
apartadoC("./ficheros/ejercicio1_2.txt");
|
||||
apartadoC("./ficheros/ejercicio1_3.txt");
|
||||
nEj1=1;
|
||||
System.out.println("\n=== APARTADO D ===");
|
||||
apartadoD("./ficheros/ejercicio1_1.txt");
|
||||
apartadoD("./ficheros/ejercicio1_2.txt");
|
||||
apartadoD("./ficheros/ejercicio1_3.txt");
|
||||
}
|
||||
|
||||
}
|
||||
182
PI3/src/main/java/adda/tests/Test2.java
Normal file
182
PI3/src/main/java/adda/tests/Test2.java
Normal file
@@ -0,0 +1,182 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jgrapht.Graph;
|
||||
import org.jgrapht.GraphPath;
|
||||
import org.jgrapht.alg.shortestpath.DijkstraShortestPath;
|
||||
import org.jgrapht.alg.tour.HeldKarpTSP;
|
||||
import org.jgrapht.graph.SimpleWeightedGraph;
|
||||
|
||||
import adda.util.Atraccion;
|
||||
import adda.util.Relacion;
|
||||
import us.lsi.colors.GraphColors;
|
||||
import us.lsi.colors.GraphColors.Color;
|
||||
import us.lsi.graphs.Graphs2;
|
||||
import us.lsi.graphs.GraphsReader;
|
||||
|
||||
public class Test2 {
|
||||
private static int nEj2 = 1;
|
||||
public static void apartadoA(String fichero, String atraccion1, String atraccion2) {
|
||||
System.out.println("Usando fichero de datos: ejercicio2_"+nEj2);
|
||||
|
||||
SimpleWeightedGraph<Atraccion, Relacion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Atraccion::ofFormat,
|
||||
Relacion::ofFormat,
|
||||
() -> Graphs2.simpleWeightedGraph(),
|
||||
a -> a.distancia()
|
||||
);
|
||||
|
||||
DijkstraShortestPath<Atraccion, Relacion> dijkstra = new DijkstraShortestPath<Atraccion, Relacion>(g);
|
||||
GraphPath<Atraccion, Relacion> caminoMinimo = dijkstra.getPath(getAtraccionPorNombre(g, atraccion1),
|
||||
getAtraccionPorNombre(g, atraccion2));
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio2a_" + nEj2 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.distancia()+" km, "+e.tiempoMedio()+" min",
|
||||
v -> GraphColors.colorIf(Color.magenta, Color.black, caminoMinimo.getVertexList().contains(v)),
|
||||
e -> GraphColors.colorIf(Color.magenta, Color.black, caminoMinimo.getEdgeList().contains(e))
|
||||
);
|
||||
|
||||
nEj2++;
|
||||
System.out.println(" "+caminoMinimo);
|
||||
}
|
||||
|
||||
private static Atraccion getAtraccionPorNombre(Graph<Atraccion,Relacion> g, String atraccion) {
|
||||
return g.vertexSet().stream().filter(a -> a.nombre().equals(atraccion)).findFirst().get();
|
||||
}
|
||||
|
||||
public static void apartadoB(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio2_"+nEj2);
|
||||
|
||||
SimpleWeightedGraph<Atraccion, Relacion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Atraccion::ofFormat,
|
||||
Relacion::ofFormat,
|
||||
() -> Graphs2.simpleWeightedGraph(),
|
||||
a -> a.distancia()
|
||||
);
|
||||
|
||||
HeldKarpTSP<Atraccion, Relacion> tsp = new HeldKarpTSP<>();
|
||||
GraphPath<Atraccion, Relacion> caminoOptimo = tsp.getTour(g);
|
||||
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio2b_" + nEj2 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.distancia()+" km, "+e.tiempoMedio()+" min",
|
||||
v -> GraphColors.colorIf(Color.magenta, Color.black, caminoOptimo.getVertexList().contains(v)),
|
||||
e -> GraphColors.colorIf(Color.magenta, Color.black, caminoOptimo.getEdgeList().contains(e))
|
||||
);
|
||||
|
||||
nEj2++;
|
||||
System.out.println(" "+caminoOptimo);
|
||||
}
|
||||
|
||||
public static void apartadoC(String fichero, Integer horasDisponibles) {
|
||||
Set<Atraccion> visitadas = new HashSet<>();
|
||||
List<Atraccion> ruta = new ArrayList<>();
|
||||
double tiempoTotal = 0.;
|
||||
|
||||
System.out.println("Usando fichero de datos: ejercicio2_"+nEj2);
|
||||
SimpleWeightedGraph<Atraccion, Relacion> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Atraccion::ofFormat,
|
||||
Relacion::ofFormat,
|
||||
() -> Graphs2.simpleWeightedGraph(),
|
||||
a -> a.tiempoMedio()
|
||||
);
|
||||
|
||||
Atraccion atrInicial = g.vertexSet().stream()
|
||||
.sorted(Comparator
|
||||
.comparing(Atraccion::popularidad)
|
||||
.reversed())
|
||||
.findFirst().get();
|
||||
|
||||
visitadas.add(atrInicial); // ya se ha visitado al empezar por ella
|
||||
ruta.add(atrInicial);
|
||||
|
||||
while(horasDisponibles*60 > tiempoTotal) {
|
||||
Atraccion atrActual = ruta.get(ruta.size()-1);
|
||||
|
||||
List<Atraccion> noVisitadas = g.edgesOf(atrActual).stream()
|
||||
.map(e -> {
|
||||
Atraccion src = g.getEdgeSource(e);
|
||||
Atraccion trg = g.getEdgeTarget(e);
|
||||
return src.equals(atrActual) ? trg : src;
|
||||
})
|
||||
.filter(vecina -> !visitadas.contains(vecina))
|
||||
.sorted(Comparator.comparing(Atraccion::popularidad).reversed())
|
||||
.toList();
|
||||
|
||||
if (noVisitadas.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Atraccion atrNext = noVisitadas.get(0);
|
||||
|
||||
DijkstraShortestPath<Atraccion, Relacion> dijkstra = new DijkstraShortestPath<>(g);
|
||||
|
||||
double tiempoViaje = dijkstra.getPathWeight(atrActual, atrNext);
|
||||
double tiempoEspera = atrNext.tiempoEsperaMedio();
|
||||
double duracionAtraccion = atrNext.duracion();
|
||||
double tiempoTotalAtraccion = tiempoViaje + tiempoEspera + duracionAtraccion;
|
||||
|
||||
if (tiempoTotal + tiempoTotalAtraccion <= horasDisponibles*60) {
|
||||
ruta.add(atrNext);
|
||||
visitadas.add(atrNext);
|
||||
tiempoTotal += tiempoTotalAtraccion;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio2c_" + nEj2 + ".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.distancia()+" km, "+e.tiempoMedio()+" min",
|
||||
v -> GraphColors.colorIf(Color.magenta, Color.black, ruta.contains(v)),
|
||||
e -> GraphColors.colorIf(Color.magenta, Color.black, containsEdge(g,e,ruta)
|
||||
)
|
||||
);
|
||||
|
||||
nEj2++;
|
||||
System.out.println(" "+ruta.stream().map(x->x.nombre()).toList());
|
||||
}
|
||||
|
||||
private static Boolean containsEdge(Graph<Atraccion,Relacion> g, Relacion e, List<Atraccion> ruta) {
|
||||
Boolean res = false;
|
||||
for(int i = 0; i < ruta.size()-1; i++) {
|
||||
if(g.getEdge(ruta.get(i), ruta.get(i+1)).equals(e)) {
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
System.out.println("--------- EJERCICIO 2 ---------\n=== APARTADO A ===");
|
||||
apartadoA("./ficheros/ejercicio2_1.txt", "Coches de choque", "Raton Vacilon");
|
||||
apartadoA("./ficheros/ejercicio2_2.txt", "Coches de choque", "Patitos");
|
||||
apartadoA("./ficheros/ejercicio2_3.txt", "Casa del Terror", "Pim pam pum");
|
||||
nEj2=1;
|
||||
System.out.println("\n=== APARTADO B ===");
|
||||
apartadoB("./ficheros/ejercicio2_1.txt");
|
||||
apartadoB("./ficheros/ejercicio2_2.txt");
|
||||
apartadoB("./ficheros/ejercicio2_3.txt");
|
||||
nEj2=1;
|
||||
System.out.println("\n=== APARTADO C ===");
|
||||
apartadoC("./ficheros/ejercicio2_1.txt",5);
|
||||
apartadoC("./ficheros/ejercicio2_2.txt",2);
|
||||
apartadoC("./ficheros/ejercicio2_3.txt",3);
|
||||
}
|
||||
|
||||
}
|
||||
171
PI3/src/main/java/adda/tests/Test3.java
Normal file
171
PI3/src/main/java/adda/tests/Test3.java
Normal file
@@ -0,0 +1,171 @@
|
||||
package adda.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jgrapht.Graph;
|
||||
import org.jgrapht.graph.SimpleDirectedGraph;
|
||||
import org.jgrapht.traverse.DepthFirstIterator;
|
||||
import org.jgrapht.traverse.TopologicalOrderIterator;
|
||||
|
||||
import adda.util.RelacionTarea;
|
||||
import adda.util.Tarea;
|
||||
import us.lsi.colors.GraphColors;
|
||||
import us.lsi.colors.GraphColors.Color;
|
||||
import us.lsi.common.List2;
|
||||
import us.lsi.graphs.Graphs2;
|
||||
import us.lsi.graphs.GraphsReader;
|
||||
|
||||
public class Test3 {
|
||||
private static int nEj3 = 1;
|
||||
|
||||
public static void apartadoA(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio3_"+nEj3);
|
||||
|
||||
SimpleDirectedGraph<Tarea, RelacionTarea> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Tarea::ofFormat,
|
||||
RelacionTarea::ofFormat,
|
||||
() -> Graphs2.simpleDirectedGraph(),
|
||||
null
|
||||
);
|
||||
|
||||
TopologicalOrderIterator<Tarea, RelacionTarea> toi = new TopologicalOrderIterator<>(g);
|
||||
List<String> tareas = new ArrayList<>();
|
||||
toi.forEachRemaining(v->tareas.add(v.nombre()));
|
||||
|
||||
nEj3++;
|
||||
System.out.println(" "+tareas);
|
||||
}
|
||||
|
||||
public static void apartadoB(String fichero, String tarea) {
|
||||
System.out.println("Usando fichero de datos: ejercicio3_"+nEj3);
|
||||
|
||||
SimpleDirectedGraph<Tarea, RelacionTarea> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Tarea::ofFormat,
|
||||
RelacionTarea::ofFormat,
|
||||
() -> Graphs2.simpleDirectedGraph(),
|
||||
null
|
||||
);
|
||||
|
||||
Tarea tInicial = g.vertexSet().stream()
|
||||
.filter(t -> t.nombre().equals(tarea))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
List<Tarea> tareas = new ArrayList<>();
|
||||
Map<Tarea, List<Tarea>> map = new HashMap<>();
|
||||
List<Tarea> pendientes = new LinkedList<>();
|
||||
|
||||
pendientes.add(tInicial);
|
||||
tareas.add(tInicial);
|
||||
map.put(tInicial, tareas);
|
||||
|
||||
while (!pendientes.isEmpty()) {
|
||||
Tarea tareaActual = pendientes.remove(0);
|
||||
|
||||
List<Tarea> tareasPrecedentes = g.incomingEdgesOf(tareaActual).stream()
|
||||
.map(e -> g.getEdgeSource(e))
|
||||
.toList();
|
||||
|
||||
for (Tarea t : tareasPrecedentes) {
|
||||
if (!map.containsKey(t)) {
|
||||
tareas.add(t);
|
||||
map.put(t, tareas);
|
||||
pendientes.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio3b_"+nEj3+".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.nombre(),
|
||||
v -> GraphColors.colorIf(Color.magenta, Color.black, tareas.contains(v)),
|
||||
e -> GraphColors.color(Color.black)
|
||||
);
|
||||
|
||||
nEj3++;
|
||||
System.out.println(tareas);
|
||||
}
|
||||
|
||||
public static void apartadoC(String fichero) {
|
||||
System.out.println("Usando fichero de datos: ejercicio3_"+nEj3);
|
||||
|
||||
SimpleDirectedGraph<Tarea, RelacionTarea> g = GraphsReader.newGraph(
|
||||
fichero,
|
||||
Tarea::ofFormat,
|
||||
RelacionTarea::ofFormat,
|
||||
() -> Graphs2.simpleDirectedGraph(),
|
||||
null
|
||||
);
|
||||
|
||||
List<Tarea> tareasNivelCero = g.vertexSet().stream()
|
||||
.filter(v -> g.incomingEdgesOf(v).isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<Tarea, Integer> map = dependenciasPorMasDependientes(g, tareasNivelCero);
|
||||
|
||||
Integer masValue = map.values().stream()
|
||||
.max((n1, n2) -> n1.compareTo(n2))
|
||||
.orElse(0);
|
||||
|
||||
List<Tarea> tareas = map.entrySet().stream()
|
||||
.filter(e -> e.getValue().equals(masValue))
|
||||
.map(Entry::getKey)
|
||||
.toList();
|
||||
|
||||
GraphColors.toDot(
|
||||
g,
|
||||
"./exports/ejercicio3c_"+nEj3+".dot",
|
||||
v -> v.nombre(),
|
||||
e -> e.nombre(),
|
||||
v -> GraphColors.colorIf(Color.magenta, Color.black, tareas.contains(v)),
|
||||
e -> GraphColors.color(Color.black)
|
||||
);
|
||||
|
||||
nEj3++;
|
||||
System.out.println(tareas);
|
||||
|
||||
}
|
||||
|
||||
private static Map<Tarea, Integer> dependenciasPorMasDependientes(
|
||||
Graph<Tarea, RelacionTarea> grafo, List<Tarea> tDependientes) {
|
||||
Map<Tarea, Integer> res = new HashMap<>();
|
||||
|
||||
for (Tarea t : tDependientes) {
|
||||
DepthFirstIterator<Tarea, RelacionTarea> dfi = new DepthFirstIterator<>(grafo, t);
|
||||
List<Tarea> aux = List2.empty();
|
||||
dfi.forEachRemaining(aux::add);
|
||||
res.put(t, aux.size());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public static void test() {
|
||||
System.out.println("--------- EJERCICIO 3 ---------\n=== APARTADO A ===");
|
||||
apartadoA("./ficheros/ejercicio3_1.txt");
|
||||
apartadoA("./ficheros/ejercicio3_2.txt");
|
||||
apartadoA("./ficheros/ejercicio3_3.txt");
|
||||
nEj3=1;
|
||||
System.out.println("\n=== APARTADO B ===");
|
||||
apartadoB("./ficheros/ejercicio3_1.txt", "Tarea5");
|
||||
apartadoB("./ficheros/ejercicio3_2.txt", "Tarea8");
|
||||
apartadoB("./ficheros/ejercicio3_3.txt", "Tarea8");
|
||||
nEj3=1;
|
||||
System.out.println("\n=== APARTADO C ===");
|
||||
apartadoC("./ficheros/ejercicio3_1.txt");
|
||||
apartadoC("./ficheros/ejercicio3_2.txt");
|
||||
apartadoC("./ficheros/ejercicio3_3.txt");
|
||||
}
|
||||
|
||||
}
|
||||
13
PI3/src/main/java/adda/tests/Tests.java
Normal file
13
PI3/src/main/java/adda/tests/Tests.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package adda.tests;
|
||||
|
||||
public class Tests {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Test1.test();
|
||||
System.out.println("\n\n");
|
||||
Test2.test();
|
||||
System.out.println("\n\n");
|
||||
Test3.test();
|
||||
}
|
||||
|
||||
}
|
||||
15
PI3/src/main/java/adda/util/Atraccion.java
Normal file
15
PI3/src/main/java/adda/util/Atraccion.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package adda.util;
|
||||
|
||||
public record Atraccion(String nombre, Integer tiempoEsperaMedio, Double popularidad, Integer duracion) {
|
||||
public static Atraccion ofFormat(String[] formato) {
|
||||
String n = formato[0];
|
||||
Integer tem = Integer.valueOf(formato[1]);
|
||||
Double p = Double.parseDouble(formato[2]);
|
||||
Integer d = Integer.valueOf(formato[3]);
|
||||
return new Atraccion(n,tem,p,d);
|
||||
}
|
||||
|
||||
public static Atraccion of(String nombre, Integer tiempoEsperaMedio, Double popularidad, Integer duracion) {
|
||||
return new Atraccion(nombre, tiempoEsperaMedio, popularidad, duracion);
|
||||
}
|
||||
}
|
||||
17
PI3/src/main/java/adda/util/Interaccion.java
Normal file
17
PI3/src/main/java/adda/util/Interaccion.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package adda.util;
|
||||
|
||||
public record Interaccion(Integer id, Double indiceInteraccion) {
|
||||
|
||||
private static int num =0;
|
||||
|
||||
public static Interaccion ofFormat(String[] formato) {
|
||||
Double indiceInteraccion = Double.parseDouble(formato[2]);
|
||||
Integer id = num;
|
||||
num++;
|
||||
return new Interaccion(id, indiceInteraccion);
|
||||
}
|
||||
|
||||
public static Interaccion of(Integer id, Double indiceInteraccion) {
|
||||
return new Interaccion(id,indiceInteraccion);
|
||||
}
|
||||
}
|
||||
17
PI3/src/main/java/adda/util/Relacion.java
Normal file
17
PI3/src/main/java/adda/util/Relacion.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package adda.util;
|
||||
|
||||
public record Relacion(Integer id, Double distancia, Double tiempoMedio) {
|
||||
private static int num =0;
|
||||
|
||||
public static Relacion ofFormat(String[] formato) {
|
||||
Integer i = num;
|
||||
Double d = Double.parseDouble(formato[2]);
|
||||
Double tm = Double.parseDouble(formato[3]);
|
||||
num++;
|
||||
return new Relacion(i, d, tm);
|
||||
}
|
||||
|
||||
public static Relacion of(Integer id, Double distancia, Double tiempoMedio) {
|
||||
return new Relacion(id,distancia, tiempoMedio);
|
||||
}
|
||||
}
|
||||
8
PI3/src/main/java/adda/util/RelacionTarea.java
Normal file
8
PI3/src/main/java/adda/util/RelacionTarea.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package adda.util;
|
||||
|
||||
public record RelacionTarea(String nombre, String independiente, String dependiente) {
|
||||
public static int i = 0;
|
||||
public static RelacionTarea ofFormat(String[] format) {
|
||||
return new RelacionTarea("Relacion-"+i++,format[0],format[1]);
|
||||
}
|
||||
}
|
||||
7
PI3/src/main/java/adda/util/Tarea.java
Normal file
7
PI3/src/main/java/adda/util/Tarea.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package adda.util;
|
||||
|
||||
public record Tarea(String nombre) {
|
||||
public static Tarea ofFormat(String[] format) {
|
||||
return new Tarea(format[0]);
|
||||
}
|
||||
}
|
||||
23
PI3/src/main/java/adda/util/Usuario.java
Normal file
23
PI3/src/main/java/adda/util/Usuario.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package adda.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public record Usuario(String nombre, Double indiceActividad, Set<String> aficiones) {
|
||||
public static Usuario ofFormat(String[] formato) {
|
||||
String nombre = formato[0];
|
||||
Double indiceActividad = Double.parseDouble(formato[1]);
|
||||
Set<String> aficiones = Arrays.stream(formato[2].replace("[", "").replace("]", "").split(";")).collect(Collectors.toSet());
|
||||
return new Usuario(nombre, indiceActividad, aficiones);
|
||||
}
|
||||
|
||||
public static Usuario of(String nombre, Double indiceActividad, Set<String> aficiones) {
|
||||
return new Usuario(nombre, indiceActividad, aficiones);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nombre+"("+this.indiceActividad+")";
|
||||
}
|
||||
}
|
||||
5
PI3/src/main/java/module-info.java
Normal file
5
PI3/src/main/java/module-info.java
Normal file
@@ -0,0 +1,5 @@
|
||||
module pi3 {
|
||||
requires partecomun;
|
||||
requires datos_compartidos;
|
||||
requires grafos;
|
||||
}
|
||||
25
PI4/.classpath
Normal file
25
PI4/.classpath
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/ParteComun">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Solve">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="/Geneticos">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
PI4/.project
Normal file
17
PI4/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PI4</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
15
PI4/.settings/org.eclipse.jdt.core.prefs
Normal file
15
PI4/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=20
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=20
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=20
|
||||
9
PI4/ficheros/ej1/Ejercicio1DatosEntrada1.txt
Normal file
9
PI4/ficheros/ej1/Ejercicio1DatosEntrada1.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
// HUERTOS
|
||||
H0: metrosdisponibles=4;
|
||||
H1: metrosdisponibles=6;
|
||||
// VARIEDADES
|
||||
V0 -> metrosrequeridos=2; incomp=V2,V4,V3;
|
||||
V1 -> metrosrequeridos=4; incomp=V2,V4;
|
||||
V2 -> metrosrequeridos=3; incomp=V0,V1,V4;
|
||||
V3 -> metrosrequeridos=1; incomp=V0,V4;
|
||||
V4 -> metrosrequeridos=6; incomp=V0,V1,V2,V3;
|
||||
11
PI4/ficheros/ej1/Ejercicio1DatosEntrada2.txt
Normal file
11
PI4/ficheros/ej1/Ejercicio1DatosEntrada2.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
// HUERTOS
|
||||
H0: metrosdisponibles=3;
|
||||
H1: metrosdisponibles=4;
|
||||
H2: metrosdisponibles=5;
|
||||
// VARIEDADES
|
||||
V0 -> metrosrequeridos=4; incomp=V3,V1,V4;
|
||||
V1 -> metrosrequeridos=2; incomp=V0,V3,V5;
|
||||
V2 -> metrosrequeridos=3; incomp=V5,V3;
|
||||
V3 -> metrosrequeridos=1; incomp=V0,V1,V2,V4;
|
||||
V4 -> metrosrequeridos=6; incomp=V0,V5,V3;
|
||||
V5 -> metrosrequeridos=2; incomp=V1,V2,V4;
|
||||
15
PI4/ficheros/ej1/Ejercicio1DatosEntrada3.txt
Normal file
15
PI4/ficheros/ej1/Ejercicio1DatosEntrada3.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
// HUERTOS
|
||||
H0: metrosdisponibles=10;
|
||||
H1: metrosdisponibles=5;
|
||||
H2: metrosdisponibles=2;
|
||||
H3: metrosdisponibles=8;
|
||||
// VARIEDADES
|
||||
V0 -> metrosrequeridos=6; incomp=V1,V2,V3,V4,V6;
|
||||
V1 -> metrosrequeridos=4; incomp=V8,V6,V5,V0,V2,V4,V7;
|
||||
V2 -> metrosrequeridos=3; incomp=V0,V1,V6,V7,V3,V5,V8;
|
||||
V3 -> metrosrequeridos=1; incomp=V6,V0,V7,V2,V4,V5;
|
||||
V4 -> metrosrequeridos=6; incomp=V0,V6,V1,V3,V8;
|
||||
V5 -> metrosrequeridos=5; incomp=V3,V2,V1,V6,V8;
|
||||
V6 -> metrosrequeridos=2; incomp=V0,V8,V5,V3,V1,V2,V4,V7;
|
||||
V7 -> metrosrequeridos=5; incomp=V8,V1,V6,V2,V3;
|
||||
V8 -> metrosrequeridos=2; incomp=V4,V2,V5,V1,V7,V6;
|
||||
7
PI4/ficheros/ej2/Ejercicio2DatosEntrada1.txt
Normal file
7
PI4/ficheros/ej2/Ejercicio2DatosEntrada1.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Presupuesto = 150
|
||||
//Id_prod:Precio:Categoria:Valoracion
|
||||
0:10:0:5
|
||||
1:150:0:4
|
||||
2:150:1:4
|
||||
3:100:2:2
|
||||
4:120:2:5
|
||||
9
PI4/ficheros/ej2/Ejercicio2DatosEntrada2.txt
Normal file
9
PI4/ficheros/ej2/Ejercicio2DatosEntrada2.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Presupuesto = 100
|
||||
//Id_prod:Precio:Categoria:Valoracion
|
||||
0:75:3:5
|
||||
1:10:2:4
|
||||
2:15:1:2
|
||||
3:50:0:2
|
||||
4:80:1:5
|
||||
5:95:2:5
|
||||
6:25:3:4
|
||||
12
PI4/ficheros/ej2/Ejercicio2DatosEntrada3.txt
Normal file
12
PI4/ficheros/ej2/Ejercicio2DatosEntrada3.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Presupuesto = 10
|
||||
//Id_prod:Precio:Categoria:Valoracion
|
||||
0:5:0:2
|
||||
1:4:2:1
|
||||
2:3:1:3
|
||||
3:5:3:1
|
||||
4:5:2:1
|
||||
5:8:4:1
|
||||
6:8:1:2
|
||||
7:7:0:5
|
||||
8:6:2:4
|
||||
9:10:1:4
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user