From 1ad353f17158314b9862c6b21c92103e4f21d4d5 Mon Sep 17 00:00:00 2001 From: Javier Marrero Date: Thu, 10 Nov 2022 19:11:39 -0500 Subject: [PATCH] Bugfix: Fixed Kosaraju and Dial's algorithm setup classes. --- src/cu/edu/cujae/graphy/algorithms/Dial.java | 52 +++++++++++++++++++ .../edu/cujae/graphy/algorithms/Kosaraju.java | 49 +++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/cu/edu/cujae/graphy/algorithms/Dial.java create mode 100644 src/cu/edu/cujae/graphy/algorithms/Kosaraju.java diff --git a/src/cu/edu/cujae/graphy/algorithms/Dial.java b/src/cu/edu/cujae/graphy/algorithms/Dial.java new file mode 100644 index 0000000..5a9c348 --- /dev/null +++ b/src/cu/edu/cujae/graphy/algorithms/Dial.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022 Ananda. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package cu.edu.cujae.graphy.algorithms; + +import cu.edu.cujae.graphy.core.Graph; +import cu.edu.cujae.graphy.utils.Pair; +import java.util.List; +import java.util.Map; + +/** + * El algoritmo de Dial, es decir, Dijkstra optimizado para pesos de rango pequeño, + * emplea una nueva estructura denominada cubo y posee una complejidad de tiempo + * O(E+WV), donde W es el peso máximo en cualquier borde del gráfico. + * La distancia máxima entre dos nodos puede tener un máximo de w(V-1). + * + * + * @author Ananda + * @param + */ +public class Dial extends AbstractAlgorithm>>> +{ + + private Graph graph; + + public Dial() + { + super(null); + } + + @Override + public Algorithm>>> apply() + { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + +} diff --git a/src/cu/edu/cujae/graphy/algorithms/Kosaraju.java b/src/cu/edu/cujae/graphy/algorithms/Kosaraju.java new file mode 100644 index 0000000..1463bc3 --- /dev/null +++ b/src/cu/edu/cujae/graphy/algorithms/Kosaraju.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2022 Ananda. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package cu.edu.cujae.graphy.algorithms; + +import cu.edu.cujae.graphy.core.Graph; + +/** + * El algoritmo de Kosaraju está basado en DFS utilizado para encontrar componentes + * fuertemente conexos (SCC) en un grafo.Si uno es capaz de alcanzar un vértice v + * a partir del vértice u, entonces uno debería ser capaz de alcanzar el vértice u + * a partir de v y si se cumple, puede decirse que v y u están en un subgrafo + * fuertemente conectados. + * + * @author Ananda + * @param + */ +public class Kosaraju extends AbstractAlgorithm +{ + + private Graph graph; + + public Kosaraju() + { + super(null); + } + + @Override + public Algorithm apply() + { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + +}