Skip to content

Commit 23e673b

Browse files
rostamclaude
andcommitted
Step 8: Seven code quality improvements
1. Remove 32 trivial checkParameters() { return null; } overrides — default already on Parametrizable 2. Clean up dead variables and commented-out experimental code in Estrada/LaplacianEstrada 3. Extract concatWithArrayCopy() to AlgorithmUtils.concatArrays(); remove 6 duplicate copies 4. Add AlgorithmUtils.getEccentricities(); eliminate duplicated max-distance loop in AllEccen, TotalEccentricityIndex, EccentricityComplexityIndex; AllEccen now delegates to Eccentricity.eccentricity() 5. Introduce WienerIndexBase to consolidate FloydWarshall boilerplate and getCategory() across WienerIndex, MWienerIndex, EccentricWienerIndex 6. Remove dead private edge_adj() methods from ZagrebCoindex, ZagrebCoindexSelectedEdges, ZagrebIndexSelectedEdges (never called in those classes) 7. Override clear() in NotifiableAttributeSetImpl to fire attributeUpdated(name, old, null) for each entry, consistent with the notification contract on put() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 18af397 commit 23e673b

49 files changed

Lines changed: 413 additions & 858 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/graphtea/extensions/AlgorithmUtils.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,4 +908,30 @@ public static Matrix getAverageTransMatrix (GraphModel g) {
908908
}
909909
return adj;
910910
}
911+
912+
/** Concatenates two arrays into a new array of the same component type. */
913+
public static <T> T[] concatArrays(T[] array1, T[] array2) {
914+
T[] result = Arrays.copyOf(array1, array1.length + array2.length);
915+
System.arraycopy(array2, 0, result, array1.length, array2.length);
916+
return result;
917+
}
918+
919+
/**
920+
* Returns the eccentricity of every vertex: ecc[v] = max distance from v to any reachable vertex.
921+
* Unreachable pairs (distance >= n+1 by FloydWarshall convention) are excluded; isolated vertices get 0.
922+
*/
923+
public static int[] getEccentricities(GraphModel g) {
924+
FloydWarshall fw = new FloydWarshall();
925+
int[][] dist = fw.getAllPairsShortestPathWithoutWeight(g);
926+
int n = g.numOfVertices();
927+
int[] ecc = new int[n];
928+
for (int v = 0; v < n; v++) {
929+
for (int u = 0; u < n; u++) {
930+
if (u != v && dist[v][u] < n + 1 && dist[v][u] > ecc[v]) {
931+
ecc[v] = dist[v][u];
932+
}
933+
}
934+
}
935+
return ecc;
936+
}
911937
}

src/graphtea/extensions/actions/BarycentricSubdivisionGraph.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ public String getDescription() {
7575
return "Barycentric Subdivision Graph";
7676
}
7777

78-
@Override
79-
public String checkParameters() {
80-
return null;
81-
}
8278

8379
@Override
8480
public String getCategory() {

src/graphtea/extensions/actions/CircularVisualization.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public static void circularVisualize(int r, int x, int y, SubGraph g) {
4545
}
4646
}
4747

48-
public String checkParameters() {
49-
return null;
50-
}
5148

5249
@Override
5350
public String getName() {

src/graphtea/extensions/actions/Composition.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ public void action(GraphData graphData) {
3737
graphData.core.showGraph(g);
3838
}
3939

40-
@Override
41-
public String checkParameters() {
42-
return null;
43-
}
4440

4541
@Override
4642
public String getCategory() {

src/graphtea/extensions/actions/Disjunction.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ public void action(GraphData graphData) {
3636
graphData.core.showGraph(g);
3737
}
3838

39-
@Override
40-
public String checkParameters() {
41-
return null;
42-
}
4339

4440
@Override
4541
public String getCategory() {

src/graphtea/extensions/actions/LocalityLens.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ public String getCategory() {
6767
return "Visualization";
6868
}
6969

70-
@Override
71-
public String checkParameters() {
72-
return null;
73-
}
7470
}
7571

7672
class MouseEventListener implements Listener {

src/graphtea/extensions/actions/ParalineGraph.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ public String getDescription() {
3434
return "Paraline Graph";
3535
}
3636

37-
@Override
38-
public String checkParameters() {
39-
return null;
40-
}
4137

4238
@Override
4339
public String getCategory() {

src/graphtea/extensions/actions/Sum.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ public void action(GraphData graphData) {
3838
graphData.core.showGraph(g);
3939
}
4040

41-
@Override
42-
public String checkParameters() {
43-
return null;
44-
}
4541

4642
@Override
4743
public String getCategory() {

src/graphtea/extensions/actions/g6/G6CSVStringLoader.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ public void action(GraphData graphData) {
7575
}
7676
}
7777

78-
public String checkParameters() {
79-
return null;
80-
}
8178

8279
@Override
8380
public String getCategory() {

src/graphtea/extensions/actions/g6/G6Checker.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public void action(GraphData graphData) {
4242
}
4343
}
4444

45-
public String checkParameters() {
46-
return null;
47-
}
4845

4946
@Override
5047
public String getCategory() {

0 commit comments

Comments
 (0)