diff --git a/src/graphtea/extensions/AlgorithmUtils.java b/src/graphtea/extensions/AlgorithmUtils.java index 97adfee0..ffb0605a 100755 --- a/src/graphtea/extensions/AlgorithmUtils.java +++ b/src/graphtea/extensions/AlgorithmUtils.java @@ -908,4 +908,30 @@ public static Matrix getAverageTransMatrix (GraphModel g) { } return adj; } + + /** Concatenates two arrays into a new array of the same component type. */ + public static T[] concatArrays(T[] array1, T[] array2) { + T[] result = Arrays.copyOf(array1, array1.length + array2.length); + System.arraycopy(array2, 0, result, array1.length, array2.length); + return result; + } + + /** + * Returns the eccentricity of every vertex: ecc[v] = max distance from v to any reachable vertex. + * Unreachable pairs (distance >= n+1 by FloydWarshall convention) are excluded; isolated vertices get 0. + */ + public static int[] getEccentricities(GraphModel g) { + FloydWarshall fw = new FloydWarshall(); + int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g); + int n = g.numOfVertices(); + int[] ecc = new int[n]; + for (int v = 0; v < n; v++) { + for (int u = 0; u < n; u++) { + if (u != v && dist[v][u] < n + 1 && dist[v][u] > ecc[v]) { + ecc[v] = dist[v][u]; + } + } + } + return ecc; + } } diff --git a/src/graphtea/extensions/actions/BarycentricSubdivisionGraph.java b/src/graphtea/extensions/actions/BarycentricSubdivisionGraph.java index e79709b6..8fba4897 100755 --- a/src/graphtea/extensions/actions/BarycentricSubdivisionGraph.java +++ b/src/graphtea/extensions/actions/BarycentricSubdivisionGraph.java @@ -75,10 +75,6 @@ public String getDescription() { return "Barycentric Subdivision Graph"; } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/CircularVisualization.java b/src/graphtea/extensions/actions/CircularVisualization.java index 6ff6e6da..e850c4ac 100755 --- a/src/graphtea/extensions/actions/CircularVisualization.java +++ b/src/graphtea/extensions/actions/CircularVisualization.java @@ -45,9 +45,6 @@ public static void circularVisualize(int r, int x, int y, SubGraph g) { } } - public String checkParameters() { - return null; - } @Override public String getName() { diff --git a/src/graphtea/extensions/actions/Composition.java b/src/graphtea/extensions/actions/Composition.java index 473c1949..bb179746 100755 --- a/src/graphtea/extensions/actions/Composition.java +++ b/src/graphtea/extensions/actions/Composition.java @@ -37,10 +37,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/Disjunction.java b/src/graphtea/extensions/actions/Disjunction.java index 999770c5..be42409e 100755 --- a/src/graphtea/extensions/actions/Disjunction.java +++ b/src/graphtea/extensions/actions/Disjunction.java @@ -36,10 +36,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/LocalityLens.java b/src/graphtea/extensions/actions/LocalityLens.java index a51f6aea..d03b3165 100755 --- a/src/graphtea/extensions/actions/LocalityLens.java +++ b/src/graphtea/extensions/actions/LocalityLens.java @@ -67,10 +67,6 @@ public String getCategory() { return "Visualization"; } - @Override - public String checkParameters() { - return null; - } } class MouseEventListener implements Listener { diff --git a/src/graphtea/extensions/actions/ParalineGraph.java b/src/graphtea/extensions/actions/ParalineGraph.java index 89c71718..15e4dfe7 100755 --- a/src/graphtea/extensions/actions/ParalineGraph.java +++ b/src/graphtea/extensions/actions/ParalineGraph.java @@ -34,10 +34,6 @@ public String getDescription() { return "Paraline Graph"; } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/Sum.java b/src/graphtea/extensions/actions/Sum.java index 52b749fd..7da8baea 100755 --- a/src/graphtea/extensions/actions/Sum.java +++ b/src/graphtea/extensions/actions/Sum.java @@ -38,10 +38,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/g6/G6CSVStringLoader.java b/src/graphtea/extensions/actions/g6/G6CSVStringLoader.java index 66749038..5a6248c2 100755 --- a/src/graphtea/extensions/actions/g6/G6CSVStringLoader.java +++ b/src/graphtea/extensions/actions/g6/G6CSVStringLoader.java @@ -75,9 +75,6 @@ public void action(GraphData graphData) { } } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/g6/G6Checker.java b/src/graphtea/extensions/actions/g6/G6Checker.java index 14df4215..8e580bc6 100755 --- a/src/graphtea/extensions/actions/g6/G6Checker.java +++ b/src/graphtea/extensions/actions/g6/G6Checker.java @@ -42,9 +42,6 @@ public void action(GraphData graphData) { } } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/g6/G6StringLoader.java b/src/graphtea/extensions/actions/g6/G6StringLoader.java index fdf5bfa2..db4a804c 100755 --- a/src/graphtea/extensions/actions/g6/G6StringLoader.java +++ b/src/graphtea/extensions/actions/g6/G6StringLoader.java @@ -51,9 +51,6 @@ public void action(GraphData graphData) { } } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/homomorphism/AHomomorphism.java b/src/graphtea/extensions/actions/homomorphism/AHomomorphism.java index 04ce78c7..38e4ec7f 100755 --- a/src/graphtea/extensions/actions/homomorphism/AHomomorphism.java +++ b/src/graphtea/extensions/actions/homomorphism/AHomomorphism.java @@ -40,10 +40,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/product/CoronaProduct.java b/src/graphtea/extensions/actions/product/CoronaProduct.java index f3fed893..d9f20a76 100755 --- a/src/graphtea/extensions/actions/product/CoronaProduct.java +++ b/src/graphtea/extensions/actions/product/CoronaProduct.java @@ -39,10 +39,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/product/Join.java b/src/graphtea/extensions/actions/product/Join.java index 08b328d6..23da13f1 100755 --- a/src/graphtea/extensions/actions/product/Join.java +++ b/src/graphtea/extensions/actions/product/Join.java @@ -40,10 +40,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/actions/product/Union.java b/src/graphtea/extensions/actions/product/Union.java index e868ab62..1fe1439d 100755 --- a/src/graphtea/extensions/actions/product/Union.java +++ b/src/graphtea/extensions/actions/product/Union.java @@ -40,10 +40,6 @@ public void action(GraphData graphData) { graphData.core.showGraph(g); } - @Override - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/generators/CocktailPartyGraph.java b/src/graphtea/extensions/generators/CocktailPartyGraph.java index 0f0a33f6..cf31bf6f 100755 --- a/src/graphtea/extensions/generators/CocktailPartyGraph.java +++ b/src/graphtea/extensions/generators/CocktailPartyGraph.java @@ -80,9 +80,6 @@ public GPoint[] getVertexPositions() { return PositionGenerators.circle(5, 5, 100000, 100000, 2*n); } - public String checkParameters() { - return null; - } public GraphModel generateGraph() { return GraphGenerator.getGraph(false, this); diff --git a/src/graphtea/extensions/generators/ExampleChainGraph1.java b/src/graphtea/extensions/generators/ExampleChainGraph1.java index 47d78e64..dc9f5ee3 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph1.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph1.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -59,16 +59,11 @@ public Edge[] getEdges() { return ret; } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, n); GPoint[] p2 = PositionGenerators.line(20, 5, 10000, 10000, n); - return concatWithArrayCopy(p1,p2); + return AlgorithmUtils.concatArrays(p1,p2); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/ExampleChainGraph2.java b/src/graphtea/extensions/generators/ExampleChainGraph2.java index 452bb375..47b5e5c6 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph2.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph2.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -65,16 +65,11 @@ public Edge[] getEdges() { return ret.toArray(ee); } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, n); GPoint[] p2 = PositionGenerators.line(1000, 5, 10000, 10000, n); - return concatWithArrayCopy(p1,p2); + return AlgorithmUtils.concatArrays(p1,p2); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/ExampleChainGraph4.java b/src/graphtea/extensions/generators/ExampleChainGraph4.java index 532882fc..7f5ab144 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph4.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph4.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -73,17 +73,12 @@ public Edge[] getEdges() { return ret.toArray(ee); } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, n); GPoint[] p2 = PositionGenerators.line(4000, 5, 10000, 10000, n); GPoint[] p3 = PositionGenerators.line(2000, 800, 10000, 10000, n-1); - return concatWithArrayCopy(concatWithArrayCopy(p1,p2), p3); + return AlgorithmUtils.concatArrays(AlgorithmUtils.concatArrays(p1,p2), p3); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/ExampleChainGraph5.java b/src/graphtea/extensions/generators/ExampleChainGraph5.java index eef691f4..12a11616 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph5.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph5.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -73,17 +73,12 @@ public Edge[] getEdges() { return ret.toArray(ee); } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, n); GPoint[] p2 = PositionGenerators.line(4000, 5, 10000, 10000, n); GPoint[] p3 = PositionGenerators.line(2000, 800, 10000, 10000, n-1); - return concatWithArrayCopy(concatWithArrayCopy(p1,p2), p3); + return AlgorithmUtils.concatArrays(AlgorithmUtils.concatArrays(p1,p2), p3); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/ExampleChainGraph6.java b/src/graphtea/extensions/generators/ExampleChainGraph6.java index b6612976..23ebd837 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph6.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph6.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -66,16 +66,11 @@ public Edge[] getEdges() { return ret.toArray(ee); } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, n); GPoint[] p2 = PositionGenerators.line(4000, 5, 10000, 10000, n); - return concatWithArrayCopy(p1,p2); + return AlgorithmUtils.concatArrays(p1,p2); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/ExampleChainGraph7.java b/src/graphtea/extensions/generators/ExampleChainGraph7.java index 6a76ed69..9ae6c490 100755 --- a/src/graphtea/extensions/generators/ExampleChainGraph7.java +++ b/src/graphtea/extensions/generators/ExampleChainGraph7.java @@ -3,6 +3,7 @@ // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.generators; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.Edge; import graphtea.graph.graph.GPoint; @@ -16,7 +17,6 @@ import graphtea.plugins.graphgenerator.core.SimpleGeneratorInterface; import graphtea.plugins.graphgenerator.core.extension.GraphGeneratorExtension; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; @@ -69,16 +69,11 @@ public Edge[] getEdges() { return ret.toArray(ee); } - static T[] concatWithArrayCopy(T[] array1, T[] array2) { - T[] result = Arrays.copyOf(array1, array1.length + array2.length); - System.arraycopy(array2, 0, result, array1.length, array2.length); - return result; - } public GPoint[] getVertexPositions() { GPoint[] p1 = PositionGenerators.line(5, 5, 10000, 10000, 2*n); GPoint[] p2 = PositionGenerators.line(4000, 5, 10000, 10000, n + 1); - return concatWithArrayCopy(p1,p2); + return AlgorithmUtils.concatArrays(p1,p2); } public String checkParameters() { diff --git a/src/graphtea/extensions/generators/NNGenerator.java b/src/graphtea/extensions/generators/NNGenerator.java index 070bf558..141e3022 100755 --- a/src/graphtea/extensions/generators/NNGenerator.java +++ b/src/graphtea/extensions/generators/NNGenerator.java @@ -86,9 +86,6 @@ public GPoint[] getVertexPositions() { } - public String checkParameters() { - return null; - } public GraphModel generateGraph() { return GraphGenerator.getGraph(true, this); diff --git a/src/graphtea/extensions/reports/basicreports/NumOfStars.java b/src/graphtea/extensions/reports/basicreports/NumOfStars.java index a2303e1d..4e52e50b 100755 --- a/src/graphtea/extensions/reports/basicreports/NumOfStars.java +++ b/src/graphtea/extensions/reports/basicreports/NumOfStars.java @@ -1,53 +1,49 @@ -// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea -// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com -// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology -// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ - -package graphtea.extensions.reports.basicreports; - -import graphtea.extensions.AlgorithmUtils; -import graphtea.graph.graph.GraphModel; -import graphtea.graph.graph.Vertex; -import graphtea.platform.lang.CommandAttitude; -import graphtea.platform.parameter.Parameter; -import graphtea.platform.parameter.Parametrizable; -import graphtea.plugins.reports.extension.GraphReportExtension; - -/** - * @author Mohammad Ali Rostami - */ - -@CommandAttitude(name = "num_of_stars", abbreviation = "_noss") -public class NumOfStars implements GraphReportExtension, Parametrizable { - - @Parameter(name = "k", description = "The size of star") - public Integer k = 1; - - public Integer calculate(GraphModel g) { - int sum = 0; - for(Vertex v : g) { - int deg = g.getDegree(v); - sum += AlgorithmUtils.choose(deg,k).intValue(); - } - return sum; - } - - public String getName() { - return "Number of Stars"; - } - - public String getDescription() { - return "Number of Stars"; - } - - @Override - public String getCategory() { - return "General"; - } - - - @Override - public String checkParameters() { - return null; - } -} +// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea +// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com +// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology +// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ + +package graphtea.extensions.reports.basicreports; + +import graphtea.extensions.AlgorithmUtils; +import graphtea.graph.graph.GraphModel; +import graphtea.graph.graph.Vertex; +import graphtea.platform.lang.CommandAttitude; +import graphtea.platform.parameter.Parameter; +import graphtea.platform.parameter.Parametrizable; +import graphtea.plugins.reports.extension.GraphReportExtension; + +/** + * @author Mohammad Ali Rostami + */ + +@CommandAttitude(name = "num_of_stars", abbreviation = "_noss") +public class NumOfStars implements GraphReportExtension, Parametrizable { + + @Parameter(name = "k", description = "The size of star") + public Integer k = 1; + + public Integer calculate(GraphModel g) { + int sum = 0; + for(Vertex v : g) { + int deg = g.getDegree(v); + sum += AlgorithmUtils.choose(deg,k).intValue(); + } + return sum; + } + + public String getName() { + return "Number of Stars"; + } + + public String getDescription() { + return "Number of Stars"; + } + + @Override + public String getCategory() { + return "General"; + } + + +} diff --git a/src/graphtea/extensions/reports/boundcheck/ConjectureChecking.java b/src/graphtea/extensions/reports/boundcheck/ConjectureChecking.java index 5e51bd60..213aeb0f 100755 --- a/src/graphtea/extensions/reports/boundcheck/ConjectureChecking.java +++ b/src/graphtea/extensions/reports/boundcheck/ConjectureChecking.java @@ -1,126 +1,122 @@ -// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea -// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com -// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology -// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ - -package graphtea.extensions.reports.boundcheck; -import graphtea.platform.core.exception.ExceptionHandler; -import graphtea.extensions.io.g6format.SaveGraph6Format; -import graphtea.extensions.reports.boundcheck.forall.IterGraphs; -import graphtea.extensions.reports.boundcheck.forall.Sizes; -import graphtea.extensions.reports.boundcheck.forall.filters.Bounds; -import graphtea.extensions.reports.boundcheck.forall.filters.Filters; -import graphtea.extensions.reports.boundcheck.forall.filters.GeneratorFilters; -import graphtea.graph.graph.GraphModel; -import graphtea.graph.graph.RenderTable; -import graphtea.platform.lang.ArrayX; -import graphtea.platform.parameter.Parameter; -import graphtea.platform.parameter.Parametrizable; -import graphtea.plugins.main.saveload.core.GraphIOException; -import graphtea.plugins.reports.extension.GraphReportExtension; -import graphtea.plugins.reports.extension.GraphReportExtensionAction; - -import javax.swing.*; -import java.io.File; -import java.util.List; - -public class ConjectureChecking implements GraphReportExtension, Parametrizable { - public ConjectureChecking() { - gfilters = Filters.getFilterNames(); - boundType = Bounds.getBoundNames(); - generators = GeneratorFilters.getGenFilters(); - PostP = new ArrayX<>("No postprocessing"); - PostP.addValidValue("Equality Filter"); - PostP.addValidValue("Max Filter"); - PostP.addValidValue("Min Filter"); - } - - @Parameter(name = "Bound Check", description = "Bound Check") - public boolean conjCheck = false; - @Parameter(name = "Connected", description = "Connected") - public boolean connected = true; - @Parameter(name = "Num Of Nodes", description = "Num Of Nodes") - public int numOfNodes = 9; -// @Parameter(name = "Up to", description = "") -// public boolean upto = false; - @Parameter(name = "Filter", description = "Filter") - public ArrayX gfilters; - @Parameter(name = "Column ID for Filter") - public int columnIDForFilter = 1; - @Parameter(name = "Graph Generators", description = "Generators") - public ArrayX generators; - @Parameter(name = "Bound Type", description = "The type of bound.") - public ArrayX boundType; - @Parameter(name="Iterative", description = "Is it iterative?") - public boolean iterative = false; - @Parameter(name="Post Processing Type", description = "The type of post processing") - public static ArrayX PostP; - @Parameter(name="Post Processing Value",description = "This is the value" + - "which the equality post-processing filter uses to compare.") - public static String ppvalue = "0"; - @Parameter(name="Graph Type", description = "Type of graphs") - public ArrayX GraphType=new ArrayX<>("all","tree","custom"); - - String currentType = "all"; - int size = 0; - - public String getName() { - return "Bound Check"; - } - - public String getDescription() { - return ""; - } - - public Object calculate(GraphModel g) { - if(PostP.getValue().equals("No postprocessing")) { - RenderTable.noFilter=true; - } - if(GraphType.getValue().equals("custom")) { - currentType=JOptionPane.showInputDialog("Please enter the custom graph6 format file:"); - size= Integer.parseInt(JOptionPane.showInputDialog("Please enter the number of graphs in file:")); - } else { - currentType=GraphType.getValue(); - currentType=currentType+numOfNodes; - size= Sizes.sizes.get(currentType); - } - - if(!conjCheck) { - GraphReportExtensionAction.ig=null; - IterGraphs itg=new IterGraphs(conjCheck,iterative,currentType, - size,boundType.getValue(),generators.getValue(), PostP.getValue(), - Filters.getCorrectFilter(gfilters), columnIDForFilter); - List gs = itg.wrapper_generate(); - String nameOfFile = JOptionPane.showInputDialog("Please enter the name of a file in which the " + - "graphs will be saved.:"); - SaveGraph6Format sgf = new SaveGraph6Format(); - File f = new File(nameOfFile); - for(GraphModel gg : gs) { - try { - sgf.write(f, gg); - } catch (GraphIOException e) { - ExceptionHandler.catchException(e); - } - } - return "The bound check is disabled. " + - "The graphs are generated and saved in the file " + nameOfFile; - } - - GraphReportExtensionAction.ig=new IterGraphs(conjCheck,iterative,currentType, - size,boundType.getValue(),generators.getValue(), PostP.getValue(), - Filters.getCorrectFilter(gfilters), columnIDForFilter); - - if(conjCheck) return "Conjecture Checking is enabled."; - return "Conjecture Checking is disabled."; - } - - @Override - public String getCategory() { - return null; - } - - @Override - public String checkParameters() { - return null; - } +// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea +// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com +// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology +// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ + +package graphtea.extensions.reports.boundcheck; +import graphtea.platform.core.exception.ExceptionHandler; +import graphtea.extensions.io.g6format.SaveGraph6Format; +import graphtea.extensions.reports.boundcheck.forall.IterGraphs; +import graphtea.extensions.reports.boundcheck.forall.Sizes; +import graphtea.extensions.reports.boundcheck.forall.filters.Bounds; +import graphtea.extensions.reports.boundcheck.forall.filters.Filters; +import graphtea.extensions.reports.boundcheck.forall.filters.GeneratorFilters; +import graphtea.graph.graph.GraphModel; +import graphtea.graph.graph.RenderTable; +import graphtea.platform.lang.ArrayX; +import graphtea.platform.parameter.Parameter; +import graphtea.platform.parameter.Parametrizable; +import graphtea.plugins.main.saveload.core.GraphIOException; +import graphtea.plugins.reports.extension.GraphReportExtension; +import graphtea.plugins.reports.extension.GraphReportExtensionAction; + +import javax.swing.*; +import java.io.File; +import java.util.List; + +public class ConjectureChecking implements GraphReportExtension, Parametrizable { + public ConjectureChecking() { + gfilters = Filters.getFilterNames(); + boundType = Bounds.getBoundNames(); + generators = GeneratorFilters.getGenFilters(); + PostP = new ArrayX<>("No postprocessing"); + PostP.addValidValue("Equality Filter"); + PostP.addValidValue("Max Filter"); + PostP.addValidValue("Min Filter"); + } + + @Parameter(name = "Bound Check", description = "Bound Check") + public boolean conjCheck = false; + @Parameter(name = "Connected", description = "Connected") + public boolean connected = true; + @Parameter(name = "Num Of Nodes", description = "Num Of Nodes") + public int numOfNodes = 9; +// @Parameter(name = "Up to", description = "") +// public boolean upto = false; + @Parameter(name = "Filter", description = "Filter") + public ArrayX gfilters; + @Parameter(name = "Column ID for Filter") + public int columnIDForFilter = 1; + @Parameter(name = "Graph Generators", description = "Generators") + public ArrayX generators; + @Parameter(name = "Bound Type", description = "The type of bound.") + public ArrayX boundType; + @Parameter(name="Iterative", description = "Is it iterative?") + public boolean iterative = false; + @Parameter(name="Post Processing Type", description = "The type of post processing") + public static ArrayX PostP; + @Parameter(name="Post Processing Value",description = "This is the value" + + "which the equality post-processing filter uses to compare.") + public static String ppvalue = "0"; + @Parameter(name="Graph Type", description = "Type of graphs") + public ArrayX GraphType=new ArrayX<>("all","tree","custom"); + + String currentType = "all"; + int size = 0; + + public String getName() { + return "Bound Check"; + } + + public String getDescription() { + return ""; + } + + public Object calculate(GraphModel g) { + if(PostP.getValue().equals("No postprocessing")) { + RenderTable.noFilter=true; + } + if(GraphType.getValue().equals("custom")) { + currentType=JOptionPane.showInputDialog("Please enter the custom graph6 format file:"); + size= Integer.parseInt(JOptionPane.showInputDialog("Please enter the number of graphs in file:")); + } else { + currentType=GraphType.getValue(); + currentType=currentType+numOfNodes; + size= Sizes.sizes.get(currentType); + } + + if(!conjCheck) { + GraphReportExtensionAction.ig=null; + IterGraphs itg=new IterGraphs(conjCheck,iterative,currentType, + size,boundType.getValue(),generators.getValue(), PostP.getValue(), + Filters.getCorrectFilter(gfilters), columnIDForFilter); + List gs = itg.wrapper_generate(); + String nameOfFile = JOptionPane.showInputDialog("Please enter the name of a file in which the " + + "graphs will be saved.:"); + SaveGraph6Format sgf = new SaveGraph6Format(); + File f = new File(nameOfFile); + for(GraphModel gg : gs) { + try { + sgf.write(f, gg); + } catch (GraphIOException e) { + ExceptionHandler.catchException(e); + } + } + return "The bound check is disabled. " + + "The graphs are generated and saved in the file " + nameOfFile; + } + + GraphReportExtensionAction.ig=new IterGraphs(conjCheck,iterative,currentType, + size,boundType.getValue(),generators.getValue(), PostP.getValue(), + Filters.getCorrectFilter(gfilters), columnIDForFilter); + + if(conjCheck) return "Conjecture Checking is enabled."; + return "Conjecture Checking is disabled."; + } + + @Override + public String getCategory() { + return null; + } + } \ No newline at end of file diff --git a/src/graphtea/extensions/reports/energy/Estrada.java b/src/graphtea/extensions/reports/energy/Estrada.java index c365567a..aeb2ecfa 100755 --- a/src/graphtea/extensions/reports/energy/Estrada.java +++ b/src/graphtea/extensions/reports/energy/Estrada.java @@ -4,26 +4,19 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.energy; -import java.util.List; import Jama.EigenvalueDecomposition; import Jama.Matrix; -import graphtea.extensions.AlgorithmUtils; -import graphtea.extensions.reports.topological.ZagrebIndexFunctions; import graphtea.graph.graph.GraphModel; import graphtea.graph.graph.RenderTable; -import graphtea.graph.graph.Vertex; import graphtea.platform.lang.CommandAttitude; import graphtea.plugins.reports.extension.GraphReportExtension; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; +import java.util.List; /** * @author Ali Rostami - */ - @CommandAttitude(name = "newInvs", abbreviation = "_newInv") public class Estrada implements GraphReportExtension { public String getName() { @@ -35,164 +28,42 @@ public String getDescription() { } public RenderTable calculate(GraphModel g) { - ZagrebIndexFunctions zif = new ZagrebIndexFunctions(g); RenderTable ret = new RenderTable(); List titles = new ArrayList<>(); titles.add(" m "); titles.add(" n "); - // titles.add(" E(G) "); - // titles.add(" 1.1 "); - // titles.add(" 1.2 "); - // titles.add(" 1.3 "); - // titles.add(" 1.4 "); - /// titles.add(" 1.5 "); - // titles.add(" 1.6 "); - // titles.add(" 1.7 "); titles.add(" Estarda "); - // titles.add(" D.Es "); titles.add(" check1 "); titles.add(" check2 "); - // titles.add(" check3 "); - // titles.add(" Eigenvalues "); - // titles.add(" 2-degree sum "); - // titles.add("new query"); ret.setTitles(titles); Matrix A = g.getWeightedAdjacencyMatrix(); EigenvalueDecomposition ed = A.eig(); double[] rv = ed.getRealEigenvalues(); - double energy=0; - double estra=0; - double es=0; - double e=0; - double tot=0; - double detA = Math.abs(A.det()); - - //positiv RV - Double[] prv = new Double[rv.length]; - for(int i=0;i al = AlgorithmUtils.getDegreesList(g); - Collections.sort(al); - maxDeg = al.get(al.size()-1); - if(al.size()-2>=0) maxDeg2 = al.get(al.size()-2); - else maxDeg2 = maxDeg; - minDeg = al.get(0); - - if(maxDeg2 == 0) maxDeg2=maxDeg; - - double a=0; - double b=0; + double estra = 0; + double es = 0; - for(Vertex v : g) { - if(g.getDegree(v)==maxDeg) a++; - if(g.getDegree(v)==minDeg) b++; + for (int i = 0; i < rv.length; i++) { + rv[i] = (double) Math.round(rv[i] * 10000000000d) / 10000000000d; + estra += Math.exp(rv[i]); + es += Math.exp(2 * rv[i]); } - if(maxDeg==minDeg) b=0; double m = g.getEdgesCount(); double n = g.getVerticesCount(); - double M12=zif.getSecondZagreb(1); - double M21=zif.getFirstZagreb(1); - double M22=zif.getSecondZagreb(2); - double Mm11=zif.getFirstZagreb(-2); - double che=tot-rv[0]; - double c=(che/(2*(n-1))); - List v = new ArrayList<>(); v.add(m); v.add(n); - // v.add(energy); v.add(estra); - v.add(Math.sqrt(n*es)); - v.add(Math.pow(n*(Math.exp(rv[0])-Math.exp(rv[rv.length-1])) ,2)/4); - - //1 - // v.add(Math.sqrt(2*m)); - // thm 2 - // v.add(Math.sqrt((es*n) - (Math.pow(n*(Math.exp(rv[0])-Math.exp(rv[rv.length-1])) ,2)/4))); - - // them 5 - // v.add((2*(n-1)*Math.exp((tot-rv[rv.length-1])/(2*(n-1)))) + (Math.exp(rv[rv.length-1]))-n+1); - - // theorem 7 - // v.add(((e*e)-n)/(n-1) ); - //2 - // v.add((2*Math.sqrt(2*m*n)*Math.sqrt(prv[0]*prv[prv.length-1])) - // /(prv[0] + prv[prv.length-1])); - //3 - // v.add((prv[0]*prv[prv.length-1]*n + 2*m)/(prv[0] + prv[prv.length-1])); - //4 - // v.add(Math.sqrt(2*m*n - // - (Math.pow(n*(prv[0]-prv[prv.length-1]),2)/4))); - //5 - // double alpha=n*Math.floor(n/2)*(1-(1/n)*Math.floor(n/2)); - // v.add(Math.sqrt(2*m*n - // - (Math.pow((prv[0]-prv[prv.length-1]),2)*alpha))); - //6 - // if(detA==0) v.add(0); - // else v.add(Math.sqrt(2*m + n*(n-1)*Math.pow(detA,2/n))); - - //7 - // double up=n*Math.pow(prv[0]-prv[prv.length-1],2); - // double down=4*(prv[0] + prv[prv.length-1]); - // v.add(Math.sqrt(2*m*n) - (up/down)); - - //eigenvalues - // v.add(getEigenValues(g)); - - //2-degree sum - // v.add(Utils.getDegreeSum(g,1)); - - - - // new query - // double eigenVal_k=prv[prv.length-1]; - // int cnt = prv.length-1; - - // if(eigenVal_k==0) { - // while(eigenVal_k==0) { - // eigenVal_k=prv[--cnt]; - // } - // } - - // int numOfNZEigenValue = 0; - // for(int i=0;i { public String getName() { @@ -35,140 +29,37 @@ public String getDescription() { } public RenderTable calculate(GraphModel g) { - ZagrebIndexFunctions zif = new ZagrebIndexFunctions(g); RenderTable ret = new RenderTable(); List titles = new ArrayList<>(); titles.add(" m "); titles.add(" n "); titles.add(" L.Estrada "); - // titles.add(" 1.1 "); - // titles.add(" 1.2 "); - // titles.add(" 1.3 "); - // titles.add(" 1.4 "); - /// titles.add(" 1.5 "); - // titles.add(" 1.6 "); - // titles.add(" 1.7 "); - // titles.add(" Laplacian Estarda "); - // titles.add(" Eigenvalues "); - // titles.add(" 2-degree sum "); - // titles.add("new query"); ret.setTitles(titles); Matrix B = g.getWeightedAdjacencyMatrix(); Matrix A = AlgorithmUtils.getLaplacian(B); EigenvalueDecomposition ed = A.eig(); double[] rv = ed.getRealEigenvalues(); - double Lsum=0; - double Lapestra=0; - double detA = Math.abs(A.det()); + double lapestra = 0; - //positiv RV - Double[] prv = new Double[rv.length]; - for(int i=0;i al = AlgorithmUtils.getDegreesList(g); - Collections.sort(al); - maxDeg = al.get(al.size()-1); - if(al.size()-2>=0) maxDeg2 = al.get(al.size()-2); - else maxDeg2 = maxDeg; - minDeg = al.get(0); - - if(maxDeg2 == 0) maxDeg2=maxDeg; - - double a=0; - double b=0; - - for(Vertex v : g) { - if(g.getDegree(v)==maxDeg) a++; - if(g.getDegree(v)==minDeg) b++; + lapestra += Math.exp(rv[i]); } - if(maxDeg==minDeg) b=0; double m = g.getEdgesCount(); double n = g.getVerticesCount(); - double M12=zif.getSecondZagreb(1); - double M21=zif.getFirstZagreb(1); - double M22=zif.getSecondZagreb(2); - double Mm11=zif.getFirstZagreb(-2); - List v = new ArrayList<>(); v.add(m); v.add(n); - - v.add(Lapestra); - //1 - // v.add(Math.sqrt(2*m)); - //2 - // v.add((2*Math.sqrt(2*m*n)*Math.sqrt(prv[0]*prv[prv.length-1])) - // /(prv[0] + prv[prv.length-1])); - //3 - // v.add((prv[0]*prv[prv.length-1]*n + 2*m)/(prv[0] + prv[prv.length-1])); - //4 - // v.add(Math.sqrt(2*m*n - // - (Math.pow(n*(prv[0]-prv[prv.length-1]),2)/4))); - //5 - // double alpha=n*Math.floor(n/2)*(1-(1/n)*Math.floor(n/2)); - // v.add(Math.sqrt(2*m*n - // - (Math.pow((prv[0]-prv[prv.length-1]),2)*alpha))); - //6 - // if(detA==0) v.add(0); - // else v.add(Math.sqrt(2*m + n*(n-1)*Math.pow(detA,2/n))); - - //7 - // double up=n*Math.pow(prv[0]-prv[prv.length-1],2); - // double down=4*(prv[0] + prv[prv.length-1]); - // v.add(Math.sqrt(2*m*n) - (up/down)); - - //eigenvalues - // v.add(getEigenValues(g)); - - //2-degree sum - // v.add(Utils.getDegreeSum(g,1)); - - - - // new query - // double eigenVal_k=prv[prv.length-1]; - // int cnt = prv.length-1; - - // if(eigenVal_k==0) { - // while(eigenVal_k==0) { - // eigenVal_k=prv[--cnt]; - // } - // } - - // int numOfNZEigenValue = 0; - // for(int i=0;i{ +public class AllEccen implements GraphReportExtension { public String getName() { return "AllEccen"; } @@ -25,16 +25,6 @@ public String getDescription() { return " AllEccen "; } - public int eccentricity(GraphModel g, int v, int[][] dist) { - int max_dist = 0; - for(int j=0;j < g.getVerticesCount();j++) { - if(max_dist < dist[v][j]) { - max_dist = dist[v][j]; - } - } - return max_dist; - } - public RenderTable calculate(GraphModel g) { ZagrebIndexFunctions zif = new ZagrebIndexFunctions(g); RenderTable ret = new RenderTable(); @@ -47,7 +37,9 @@ public RenderTable calculate(GraphModel g) { ret.setTitles(titles); double m = g.getEdgesCount(); - if(m==10) return null; + if (m == 10) { + return null; + } double n = g.getVerticesCount(); List v = new ArrayList<>(); @@ -57,20 +49,20 @@ public RenderTable calculate(GraphModel g) { FloydWarshall fw = new FloydWarshall(); int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g); int total_eccentricity = 0; - for(Vertex ver : g) { - total_eccentricity += eccentricity(g, ver.getId(), dist); + for (Vertex ver : g) { + total_eccentricity += Eccentricity.eccentricity(g, ver.getId(), dist); } v.add(total_eccentricity); int eccentric_connectivity_index = 0; - for(Vertex ver : g) { - eccentric_connectivity_index += eccentricity(g, ver.getId(), dist)*g.getDegree(ver); + for (Vertex ver : g) { + eccentric_connectivity_index += Eccentricity.eccentricity(g, ver.getId(), dist) * g.getDegree(ver); } v.add(eccentric_connectivity_index); double connective_eccentric_index = 0; - for(Vertex ver : g) { - connective_eccentric_index += (double)g.getDegree(ver)/eccentricity(g, ver.getId(), dist); + for (Vertex ver : g) { + connective_eccentric_index += (double) g.getDegree(ver) / Eccentricity.eccentricity(g, ver.getId(), dist); } v.add(connective_eccentric_index); ret.add(v); @@ -82,9 +74,3 @@ public String getCategory() { return "Verification-Checking"; } } - - - - - - diff --git a/src/graphtea/extensions/reports/spectralreports/EigenValues.java b/src/graphtea/extensions/reports/spectralreports/EigenValues.java index a1f8be6a..5675e512 100755 --- a/src/graphtea/extensions/reports/spectralreports/EigenValues.java +++ b/src/graphtea/extensions/reports/spectralreports/EigenValues.java @@ -1,95 +1,91 @@ -// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea -// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com -// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology -// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ - -package graphtea.extensions.reports.spectralreports; - +// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea +// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com +// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology +// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ + +package graphtea.extensions.reports.spectralreports; + import java.util.List; -import Jama.EigenvalueDecomposition; -import Jama.Matrix; -import graphtea.extensions.AlgorithmUtils; -import graphtea.graph.graph.GraphModel; -import graphtea.library.util.Complex; -import graphtea.platform.lang.CommandAttitude; -import graphtea.platform.parameter.Parameter; -import graphtea.platform.parameter.Parametrizable; -import graphtea.plugins.reports.extension.GraphReportExtension; - -import java.util.ArrayList; - -/** - * @author M. Ali Rostami - */ - -@CommandAttitude(name = "eig_values", abbreviation = "_evs") -public class EigenValues implements GraphReportExtension>,Parametrizable { - - @Parameter(name = "power:", description = "The power of the eigen values") - public double power = 2; - - public ArrayList calculate(GraphModel g) { - ArrayList res = new ArrayList<>(); - Matrix A = g.getWeightedAdjacencyMatrix(); - EigenvalueDecomposition ed = A.eig(); - double[] rv = ed.getRealEigenvalues(); - double[] iv = ed.getImagEigenvalues(); - double maxrv=0; - double minrv=1000000; - for(double value : rv) { - double tval = Math.abs(value); - if(maxrv < tval) maxrv=tval; - if(minrv > tval) minrv=tval; - } - res.add("Largest Eigen Value"); - res.add(AlgorithmUtils.round(maxrv, 10)+""); - res.add("Smallest Eigen Value"); - res.add(AlgorithmUtils.round(minrv, 10)+""); - - res.add("Sum of power of Eigen Values"); - double sum = 0; - double sum_i = 0; - for (double aRv : rv) sum += Math.pow(Math.abs(aRv), power); - for (double anIv : iv) sum_i += Math.abs(anIv); - - if (sum_i != 0) { - sum_i=0; - Complex num = new Complex(0,0); - for(int i=0;i < iv.length;i++) { - Complex tmp = new Complex(rv[i], iv[i]); - Complex.pow(new Complex(power,0)); - num.plus(tmp); - } - res.add("" + AlgorithmUtils.round(num.re(), 10) + " + " - + AlgorithmUtils.round(num.im(), 10) + "i"); - } else { - res.add("" + AlgorithmUtils.round(sum, 10)); - } - res.add("Eigen Values"); - for (int i = 0; i < rv.length; i++) { - if (iv[i] != 0) - res.add("" + AlgorithmUtils.round(rv[i], 10) + " + " + AlgorithmUtils.round(iv[i], 10) + "i"); - else - res.add("" + AlgorithmUtils.round(rv[i], 10)); - } - return res; - } - - public String getName() { - return "Eigen Values"; - } - - public String getDescription() { - return "Eigen Values"; - } - - @Override - public String getCategory() { - return "Spectral- Energies"; - } - - @Override - public String checkParameters() { - return null; - } -} +import Jama.EigenvalueDecomposition; +import Jama.Matrix; +import graphtea.extensions.AlgorithmUtils; +import graphtea.graph.graph.GraphModel; +import graphtea.library.util.Complex; +import graphtea.platform.lang.CommandAttitude; +import graphtea.platform.parameter.Parameter; +import graphtea.platform.parameter.Parametrizable; +import graphtea.plugins.reports.extension.GraphReportExtension; + +import java.util.ArrayList; + +/** + * @author M. Ali Rostami + */ + +@CommandAttitude(name = "eig_values", abbreviation = "_evs") +public class EigenValues implements GraphReportExtension>,Parametrizable { + + @Parameter(name = "power:", description = "The power of the eigen values") + public double power = 2; + + public ArrayList calculate(GraphModel g) { + ArrayList res = new ArrayList<>(); + Matrix A = g.getWeightedAdjacencyMatrix(); + EigenvalueDecomposition ed = A.eig(); + double[] rv = ed.getRealEigenvalues(); + double[] iv = ed.getImagEigenvalues(); + double maxrv=0; + double minrv=1000000; + for(double value : rv) { + double tval = Math.abs(value); + if(maxrv < tval) maxrv=tval; + if(minrv > tval) minrv=tval; + } + res.add("Largest Eigen Value"); + res.add(AlgorithmUtils.round(maxrv, 10)+""); + res.add("Smallest Eigen Value"); + res.add(AlgorithmUtils.round(minrv, 10)+""); + + res.add("Sum of power of Eigen Values"); + double sum = 0; + double sum_i = 0; + for (double aRv : rv) sum += Math.pow(Math.abs(aRv), power); + for (double anIv : iv) sum_i += Math.abs(anIv); + + if (sum_i != 0) { + sum_i=0; + Complex num = new Complex(0,0); + for(int i=0;i < iv.length;i++) { + Complex tmp = new Complex(rv[i], iv[i]); + Complex.pow(new Complex(power,0)); + num.plus(tmp); + } + res.add("" + AlgorithmUtils.round(num.re(), 10) + " + " + + AlgorithmUtils.round(num.im(), 10) + "i"); + } else { + res.add("" + AlgorithmUtils.round(sum, 10)); + } + res.add("Eigen Values"); + for (int i = 0; i < rv.length; i++) { + if (iv[i] != 0) + res.add("" + AlgorithmUtils.round(rv[i], 10) + " + " + AlgorithmUtils.round(iv[i], 10) + "i"); + else + res.add("" + AlgorithmUtils.round(rv[i], 10)); + } + return res; + } + + public String getName() { + return "Eigen Values"; + } + + public String getDescription() { + return "Eigen Values"; + } + + @Override + public String getCategory() { + return "Spectral- Energies"; + } + +} diff --git a/src/graphtea/extensions/reports/topological/EccentricWienerIndex.java b/src/graphtea/extensions/reports/topological/EccentricWienerIndex.java index e1e14c97..b6e69b30 100755 --- a/src/graphtea/extensions/reports/topological/EccentricWienerIndex.java +++ b/src/graphtea/extensions/reports/topological/EccentricWienerIndex.java @@ -4,19 +4,15 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.topological; -import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; import graphtea.extensions.reports.others.Eccentricity; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; -import graphtea.plugins.reports.extension.GraphReportExtension; /** * @author Ali Rostami */ - - @CommandAttitude(name = "eccentric_wiener_index", abbreviation = "_ewindex") -public class EccentricWienerIndex implements GraphReportExtension { +public class EccentricWienerIndex extends WienerIndexBase { public String getName() { return "Eccentric Wiener Index"; } @@ -25,32 +21,18 @@ public String getDescription() { return "Eccentric Wiener Index"; } - /** - * In chemical graph theory, the Wiener index (also Wiener number) - * introduced by Harry Wiener, is a topological index of a molecule, - * defined as the sum of the lengths of the shortest paths between all pairs of vertices - * in the chemical graph representing the non-hydrogen atoms in the molecule. - * - * @param g the given graph - * @return the wiener index - */ - public Integer calculate(GraphModel g) { - int sum =0; - FloydWarshall fw = new FloydWarshall(); - int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g); + @Override + protected Integer compute(GraphModel g, int[][] dist) { + int sum = 0; for (int v = 0; v < g.numOfVertices(); v++) { - for (int u = v+1; u < g.numOfVertices(); u++) { - double eu = Eccentricity.eccentricity(g,u,dist); - double ev = Eccentricity.eccentricity(g,v,dist); - double epsilon = dist[v][u] == Math.min(eu,ev) ? dist[v][u] : 0; - sum += epsilon; + for (int u = v + 1; u < g.numOfVertices(); u++) { + double eu = Eccentricity.eccentricity(g, u, dist); + double ev = Eccentricity.eccentricity(g, v, dist); + if (dist[v][u] == Math.min(eu, ev)) { + sum += dist[v][u]; + } } } return sum; } - - @Override - public String getCategory() { - return "Topological Indices-Wiener Types"; - } } diff --git a/src/graphtea/extensions/reports/topological/EccentricityComplexityIndex.java b/src/graphtea/extensions/reports/topological/EccentricityComplexityIndex.java index db13851b..6b2b253b 100755 --- a/src/graphtea/extensions/reports/topological/EccentricityComplexityIndex.java +++ b/src/graphtea/extensions/reports/topological/EccentricityComplexityIndex.java @@ -4,7 +4,7 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.topological; -import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; import graphtea.plugins.reports.extension.GraphReportExtension; @@ -15,7 +15,6 @@ /** * @author Ali Rostami */ - @CommandAttitude(name = "eccentricitycomplexity_index", abbreviation = "_Ecomplexindex") public class EccentricityComplexityIndex implements GraphReportExtension { public String getName() { @@ -27,35 +26,18 @@ public String getDescription() { } public Integer calculate(GraphModel g) { - FloydWarshall fw = new FloydWarshall(); - int[][] spt = fw.getAllPairsShortestPathWithoutWeight(g); - int vEccentricity; - Set uniqueEccentricities = new HashSet<>(); - + int[] ecc = AlgorithmUtils.getEccentricities(g); + Set uniqueEccentricities = new HashSet<>(); for (int v = 0; v < g.numOfVertices(); v++) { - vEccentricity = 0; - for (int u = 0; u < g.numOfVertices(); u++) { - if (v == u) { - continue; - } - if(spt[v][u] < g.numOfVertices() + 1) { - int dist = spt[u][v]; - if(dist > vEccentricity) { - vEccentricity = dist; - } - } - } - - if (vEccentricity > 0) { - uniqueEccentricities.add(vEccentricity); + if (ecc[v] > 0) { + uniqueEccentricities.add(ecc[v]); } } - return uniqueEccentricities.size(); } - @Override - public String getCategory() { - return "Topological Indices-Distance"; - } + @Override + public String getCategory() { + return "Topological Indices-Distance"; + } } diff --git a/src/graphtea/extensions/reports/topological/HyperZagrebIndex.java b/src/graphtea/extensions/reports/topological/HyperZagrebIndex.java index 3b874b29..387e7314 100755 --- a/src/graphtea/extensions/reports/topological/HyperZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/HyperZagrebIndex.java @@ -33,9 +33,6 @@ public ArrayList calculate(GraphModel g) { return out; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/IncrementalVariableZagrebIndex.java b/src/graphtea/extensions/reports/topological/IncrementalVariableZagrebIndex.java index dca3584b..f99162e4 100755 --- a/src/graphtea/extensions/reports/topological/IncrementalVariableZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/IncrementalVariableZagrebIndex.java @@ -56,9 +56,6 @@ public RenderTable calculate(GraphModel g) { return ret; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindex.java b/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindex.java index d06adfad..e805e1e8 100755 --- a/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindex.java +++ b/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindex.java @@ -60,9 +60,6 @@ public RenderTable calculate(GraphModel g) { return ret; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindexSelectedEdges.java b/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindexSelectedEdges.java index e9e64c95..88cd5b6d 100755 --- a/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindexSelectedEdges.java +++ b/src/graphtea/extensions/reports/topological/IncrementalZagrebCoindexSelectedEdges.java @@ -57,9 +57,6 @@ public RenderTable calculate(GraphModel g) { return ret; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/IncrementalZagrebIndex.java b/src/graphtea/extensions/reports/topological/IncrementalZagrebIndex.java index f9634d2e..254caf36 100755 --- a/src/graphtea/extensions/reports/topological/IncrementalZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/IncrementalZagrebIndex.java @@ -61,9 +61,6 @@ public RenderTable calculate(GraphModel g) { return ret; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/IncrementalZagrebIndexSelectedEdges.java b/src/graphtea/extensions/reports/topological/IncrementalZagrebIndexSelectedEdges.java index fba721b3..e138d42f 100755 --- a/src/graphtea/extensions/reports/topological/IncrementalZagrebIndexSelectedEdges.java +++ b/src/graphtea/extensions/reports/topological/IncrementalZagrebIndexSelectedEdges.java @@ -62,9 +62,6 @@ public RenderTable calculate(GraphModel g) { return ret; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/MWienerIndex.java b/src/graphtea/extensions/reports/topological/MWienerIndex.java index b19f64a9..c7454cd6 100755 --- a/src/graphtea/extensions/reports/topological/MWienerIndex.java +++ b/src/graphtea/extensions/reports/topological/MWienerIndex.java @@ -4,17 +4,14 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.topological; -import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; -import graphtea.plugins.reports.extension.GraphReportExtension; /** * @author Ali Rostami */ - @CommandAttitude(name = "mwiener_index", abbreviation = "_windex") -public class MWienerIndex implements GraphReportExtension { +public class MWienerIndex extends WienerIndexBase { public String getName() { return "Multiplicative Wiener Index"; } @@ -23,26 +20,16 @@ public String getDescription() { return "Multiplicative Wiener Index"; } - public Integer calculate(GraphModel g) { - int sum =1; - FloydWarshall fw = new FloydWarshall(); - int[][] spt = fw.getAllPairsShortestPathWithoutWeight(g); - double max = 0; + @Override + protected Integer compute(GraphModel g, int[][] dist) { + int product = 1; for (int v = 0; v < g.numOfVertices(); v++) { - for (int u = v+1; u < g.numOfVertices(); u++) { - if(spt[v][u] < g.numOfVertices() + 1) { - double dist = spt[u][v]; - if(dist > max) { - sum *= dist; - } + for (int u = v + 1; u < g.numOfVertices(); u++) { + if (dist[v][u] < g.numOfVertices() + 1 && dist[u][v] > 0) { + product *= dist[u][v]; } } } - return sum; + return product; } - - @Override - public String getCategory() { - return "Topological Indices-Wiener Types"; - } } diff --git a/src/graphtea/extensions/reports/topological/PathZagrebIndex.java b/src/graphtea/extensions/reports/topological/PathZagrebIndex.java index a054115b..55cc5e82 100755 --- a/src/graphtea/extensions/reports/topological/PathZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/PathZagrebIndex.java @@ -39,9 +39,6 @@ public ArrayList calculate(GraphModel g) { return out; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/SecondMixZagrebIndex.java b/src/graphtea/extensions/reports/topological/SecondMixZagrebIndex.java index 9905db95..d75d76e2 100755 --- a/src/graphtea/extensions/reports/topological/SecondMixZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/SecondMixZagrebIndex.java @@ -46,8 +46,4 @@ public String getCategory() { return "Topological Indices-Zagreb Indices"; } - @Override - public String checkParameters() { - return null; - } } diff --git a/src/graphtea/extensions/reports/topological/TotalEccentricityIndex.java b/src/graphtea/extensions/reports/topological/TotalEccentricityIndex.java index 3869d2c2..a90b574d 100755 --- a/src/graphtea/extensions/reports/topological/TotalEccentricityIndex.java +++ b/src/graphtea/extensions/reports/topological/TotalEccentricityIndex.java @@ -4,7 +4,7 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.topological; -import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; +import graphtea.extensions.AlgorithmUtils; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; import graphtea.plugins.reports.extension.GraphReportExtension; @@ -12,7 +12,6 @@ /** * @author Ali Rostami */ - @CommandAttitude(name = "totaleccentricity_index", abbreviation = "_TEindex") public class TotalEccentricityIndex implements GraphReportExtension { public String getName() { @@ -24,36 +23,18 @@ public String getDescription() { } public Double calculate(GraphModel g) { - FloydWarshall fw = new FloydWarshall(); - int[][] spt = fw.getAllPairsShortestPathWithoutWeight(g); - - double maxVUDistance; - double sum = 0; - + int[] ecc = AlgorithmUtils.getEccentricities(g); + double sum = 0; for (int v = 0; v < g.numOfVertices(); v++) { - maxVUDistance = 0; - for (int u = 0; u < g.numOfVertices(); u++) { - if (v == u) { - continue; - } - if(spt[v][u] < g.numOfVertices() + 1) { - double dist = spt[u][v]; - if(dist > maxVUDistance) { - maxVUDistance = dist; - } - } - } - - if (maxVUDistance > 0) { - sum += g.getDegree(g.getVertex(v)) * maxVUDistance; + if (ecc[v] > 0) { + sum += g.getDegree(g.getVertex(v)) * ecc[v]; } } - return sum; } - @Override - public String getCategory() { - return "Topological Indices-Distance"; - } + @Override + public String getCategory() { + return "Topological Indices-Distance"; + } } diff --git a/src/graphtea/extensions/reports/topological/VariableZagrebIndex.java b/src/graphtea/extensions/reports/topological/VariableZagrebIndex.java index 6e48dacb..bfd2daa0 100755 --- a/src/graphtea/extensions/reports/topological/VariableZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/VariableZagrebIndex.java @@ -39,9 +39,6 @@ public ArrayList calculate(GraphModel g) { return out; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/WienerIndex.java b/src/graphtea/extensions/reports/topological/WienerIndex.java index 4408df17..c8e28d2e 100755 --- a/src/graphtea/extensions/reports/topological/WienerIndex.java +++ b/src/graphtea/extensions/reports/topological/WienerIndex.java @@ -4,19 +4,18 @@ // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ package graphtea.extensions.reports.topological; -import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; -import graphtea.plugins.reports.extension.GraphReportExtension; /** + * In chemical graph theory, the Wiener index (also Wiener number) introduced by Harry Wiener, + * is a topological index defined as the sum of the lengths of the shortest paths between all + * pairs of vertices in the graph. + * * @author Ali Rostami - */ - - @CommandAttitude(name = "wiener_index", abbreviation = "_windex") -public class WienerIndex implements GraphReportExtension { +public class WienerIndex extends WienerIndexBase { public String getName() { return "Wiener Index"; } @@ -25,35 +24,16 @@ public String getDescription() { return "Wiener Index"; } - /** - * In chemical graph theory, the Wiener index (also Wiener number) - * introduced by Harry Wiener, is a topological index of a molecule, - * defined as the sum of the lengths of the shortest paths between all pairs of vertices - * in the chemical graph representing the non-hydrogen atoms in the molecule. - * - * @param g the given graph - * @return the wiener index - */ - public Integer calculate(GraphModel g) { - int sum =0; - FloydWarshall fw = new FloydWarshall(); - int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g); - double max = 0; + @Override + protected Integer compute(GraphModel g, int[][] dist) { + int sum = 0; for (int v = 0; v < g.numOfVertices(); v++) { - for (int u = v+1; u < g.numOfVertices(); u++) { - if(dist[v][u] < g.numOfVertices()) { - double distance = dist[u][v]; - if(distance > max) { - sum += distance; - } + for (int u = v + 1; u < g.numOfVertices(); u++) { + if (dist[v][u] < g.numOfVertices()) { + sum += dist[u][v]; } } } return sum; } - - @Override - public String getCategory() { - return "Topological Indices-Wiener Types"; - } } diff --git a/src/graphtea/extensions/reports/topological/WienerIndexBase.java b/src/graphtea/extensions/reports/topological/WienerIndexBase.java new file mode 100644 index 00000000..77e496a4 --- /dev/null +++ b/src/graphtea/extensions/reports/topological/WienerIndexBase.java @@ -0,0 +1,32 @@ +// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea +// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com +// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology +// Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ +package graphtea.extensions.reports.topological; + +import graphtea.extensions.algorithms.shortestpath.algs.FloydWarshall; +import graphtea.graph.graph.GraphModel; +import graphtea.plugins.reports.extension.GraphReportExtension; + +/** + * Shared base for Wiener-type topological indices. + * Subclasses implement {@link #compute(GraphModel, int[][])} with the + * all-pairs shortest-path matrix already computed. + */ +abstract class WienerIndexBase implements GraphReportExtension { + + @Override + public final Integer calculate(GraphModel g) { + FloydWarshall fw = new FloydWarshall(); + int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g); + return compute(g, dist); + } + + /** Compute the index value given the graph and its all-pairs distance matrix. */ + protected abstract Integer compute(GraphModel g, int[][] dist); + + @Override + public String getCategory() { + return "Topological Indices-Wiener Types"; + } +} diff --git a/src/graphtea/extensions/reports/topological/ZagrebCoindex.java b/src/graphtea/extensions/reports/topological/ZagrebCoindex.java index 717c1a37..58442e32 100755 --- a/src/graphtea/extensions/reports/topological/ZagrebCoindex.java +++ b/src/graphtea/extensions/reports/topological/ZagrebCoindex.java @@ -5,7 +5,6 @@ package graphtea.extensions.reports.topological; import java.util.List; -import graphtea.graph.graph.Edge; import graphtea.graph.graph.GraphModel; import graphtea.platform.lang.CommandAttitude; import graphtea.platform.parameter.Parameter; @@ -43,20 +42,7 @@ public ArrayList calculate(GraphModel g) { return out; } - private boolean edge_adj(Edge e1,Edge e2) { - if(e1.source.getId()==e2.source.getId() && - e1.target.getId()==e2.target.getId()) return false; - else if(e1.target.getId()==e2.source.getId() && - e1.source.getId()==e2.target.getId()) return false; - else if(e1.source.getId() == e2.source.getId()) return true; - else if(e1.source.getId() == e2.target.getId()) return true; - else if(e1.target.getId() == e2.source.getId()) return true; - else return e1.target.getId() == e2.target.getId(); - } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/ZagrebCoindexSelectedEdges.java b/src/graphtea/extensions/reports/topological/ZagrebCoindexSelectedEdges.java index c7103cf1..70d05262 100755 --- a/src/graphtea/extensions/reports/topological/ZagrebCoindexSelectedEdges.java +++ b/src/graphtea/extensions/reports/topological/ZagrebCoindexSelectedEdges.java @@ -40,20 +40,7 @@ public ArrayList calculate(GraphModel g) { return out; } - private boolean edge_adj(Edge e1,Edge e2) { - if(e1.source.getId()==e2.source.getId() && - e1.target.getId()==e2.target.getId()) return false; - else if(e1.target.getId()==e2.source.getId() && - e1.source.getId()==e2.target.getId()) return false; - else if(e1.source.getId() == e2.source.getId()) return true; - else if(e1.source.getId() == e2.target.getId()) return true; - else if(e1.target.getId() == e2.source.getId()) return true; - else return e1.target.getId() == e2.target.getId(); - } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/ZagrebIndex.java b/src/graphtea/extensions/reports/topological/ZagrebIndex.java index 58f5e34b..c4e5706f 100755 --- a/src/graphtea/extensions/reports/topological/ZagrebIndex.java +++ b/src/graphtea/extensions/reports/topological/ZagrebIndex.java @@ -51,9 +51,6 @@ public RenderTable calculate(GraphModel g) { return renderTable; } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/extensions/reports/topological/ZagrebIndexSelectedEdges.java b/src/graphtea/extensions/reports/topological/ZagrebIndexSelectedEdges.java index 866ece50..e7571689 100755 --- a/src/graphtea/extensions/reports/topological/ZagrebIndexSelectedEdges.java +++ b/src/graphtea/extensions/reports/topological/ZagrebIndexSelectedEdges.java @@ -42,20 +42,7 @@ public ArrayList calculate(GraphModel g) { return out; } - private boolean edge_adj(Edge e1,Edge e2) { - if(e1.source.getId()==e2.source.getId() && - e1.target.getId()==e2.target.getId()) return false; - else if(e1.target.getId()==e2.source.getId() && - e1.source.getId()==e2.target.getId()) return false; - else if(e1.source.getId() == e2.source.getId()) return true; - else if(e1.source.getId() == e2.target.getId()) return true; - else if(e1.target.getId() == e2.source.getId()) return true; - else return e1.target.getId() == e2.target.getId(); - } - public String checkParameters() { - return null; - } @Override public String getCategory() { diff --git a/src/graphtea/platform/attribute/NotifiableAttributeSetImpl.java b/src/graphtea/platform/attribute/NotifiableAttributeSetImpl.java index 999c1429..79aff404 100755 --- a/src/graphtea/platform/attribute/NotifiableAttributeSetImpl.java +++ b/src/graphtea/platform/attribute/NotifiableAttributeSetImpl.java @@ -24,6 +24,14 @@ public void put(String name, Object value) { fireAttributeChange(getAttributeListeners(), name, old, value); } + @Override + public void clear() { + for (String name : atr.keySet()) { + fireAttributeChange(getAttributeListeners(), name, atr.get(name), null); + } + super.clear(); + } + public void addAttributeListener(AttributeListener attributeListener) { globalListeners.add(attributeListener); } diff --git a/src/graphtea/platform/extension/ExtensionLoader.java b/src/graphtea/platform/extension/ExtensionLoader.java index fc0fbeda..924c020b 100755 --- a/src/graphtea/platform/extension/ExtensionLoader.java +++ b/src/graphtea/platform/extension/ExtensionLoader.java @@ -13,6 +13,7 @@ import java.io.File; import java.lang.reflect.Constructor; +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -94,7 +95,8 @@ public static AbstractAction handleExtension(BlackBoard b, Extension e) { public static Extension loadExtension(Class extensionClass) { Extension ret = null; try { - if (Extension.class.isAssignableFrom(extensionClass)) { + if (Extension.class.isAssignableFrom(extensionClass) + && !Modifier.isAbstract(extensionClass.getModifiers())) { Constructor[] cs = (Constructor[]) extensionClass.getConstructors(); for (Constructor c : cs) { Class[] p = c.getParameterTypes(); diff --git a/src/graphtea/platform/preferences/lastsettings/Settings.java b/src/graphtea/platform/preferences/lastsettings/Settings.java index 0650a309..386f6b8d 100755 --- a/src/graphtea/platform/preferences/lastsettings/Settings.java +++ b/src/graphtea/platform/preferences/lastsettings/Settings.java @@ -61,6 +61,7 @@ private void saveField(Field f, java.util.prefs.Preferences t, Object o) { // Object value=o.getClass().getDeclaredField(f.getName()).get(o); Object value = null; try { + f.setAccessible(true); value = f.get(o); } catch (Exception e) { System.err.println(f); @@ -85,6 +86,7 @@ private ByteArrayOutputStream convertObjectToByteArray(Object value) { } private void loadField(Field f, java.util.prefs.Preferences t, Object o) { + f.setAccessible(true); String key = f.getName(); Object value = t.get(key, null); String m = f.getType().toString();