Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
387fa5e
Checkpoint: Immediately after migrating via `mvn org.gephi:gephi-mave…
carlschroedl Oct 31, 2016
bb16b82
First pass at fixing 0.8 to 0.9 API differences. The SpanningTree module
carlschroedl Nov 3, 2016
e8ba8a9
Correcting Plugin metdata. Now passes gephi plugin validation via `mv…
carlschroedl Nov 3, 2016
e6f49d0
Adding jUnit, test skeleton
carlschroedl Nov 3, 2016
77627a3
Moving example data to paths paralleling package structure
carlschroedl Nov 4, 2016
d6e657a
Broken checkpoint -- starting to import data based off example from
carlschroedl Nov 4, 2016
ef6237b
Broken checkpoint. Can't get ImportController#importFile() to return
carlschroedl Nov 6, 2016
fc76ce9
Merge branch 'master' into spanning-tree-integration-test
carlschroedl Nov 6, 2016
2eff609
Dependency additions to enable importing graphs from file
carlschroedl Nov 6, 2016
67d06d9
Broken checkpoint: building graph edge&node equality checker and
carlschroedl Nov 6, 2016
10c84df
Could not open *.gephi files. Switching to Graph ML. Now experimentin…
carlschroedl Nov 7, 2016
86a73b2
Successfully loaded two graphs simultaneously
carlschroedl Nov 20, 2016
b322cfb
Formatting, removing unused imports.
carlschroedl Nov 20, 2016
f58094e
Moved graph equality comparison to another class.
carlschroedl Nov 20, 2016
e4b8ceb
Refactored loading functionality into a separate file. Improved graph
carlschroedl Nov 21, 2016
e28b4dc
Discovered and fixed bug via new tests.
carlschroedl Nov 28, 2016
61137ba
Cleanup and small test addition.
carlschroedl Nov 28, 2016
46a4dcc
Adding ability to report test coverage. Increasing test coverage to new
carlschroedl Nov 28, 2016
643871b
Complete line coverage achieved for GraphTopologyEquals.
carlschroedl Nov 29, 2016
783b599
Successfully implemented a post-alorithm filter to exclude edges that
carlschroedl Nov 29, 2016
0cd76b8
Reducing specificity
carlschroedl Nov 29, 2016
d04f2f4
Refactoring MST edge filtering into its own method.
carlschroedl Nov 29, 2016
ee0b151
Removed unused imports
carlschroedl Nov 29, 2016
64c34c4
Switching back to integer spanning tree attribute because the test data
carlschroedl Nov 29, 2016
39e828f
Re-branding as "Minimum Spanning Tree Plugin" at the maven level.
carlschroedl Dec 18, 2016
6bce82a
Rebranding to 'MinimumSpanningTree' at the file system level
carlschroedl Dec 18, 2016
6c4f4d1
Updating rebranded module path in the parent pom
carlschroedl Dec 18, 2016
93a9a2d
Rebranding java packages to
carlschroedl Dec 18, 2016
679e7bf
Updating public packages with rebranding.
carlschroedl Dec 18, 2016
da42c77
Rebranding as MinimumSpanningTree at the class name levl. Also rebranded
carlschroedl Dec 18, 2016
bd39daa
fixing typo in user-facing text
carlschroedl Dec 18, 2016
d6ac100
Documenting and generalizing utility script
carlschroedl Dec 18, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions modules/MinimumSpanningTree/gpl-3.0.txt

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions modules/MinimumSpanningTree/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>gephi-plugin-parent</artifactId>
<groupId>org.gephi</groupId>
<version>0.9.1</version>
</parent>

<groupId>com.carlschroedl.gephi</groupId>
<artifactId>spanning-tree-plugin</artifactId>
<version>1.0.0</version>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok that this is a release version instead of a SNAPSHOT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, your plugin can declare any version number you want. Just future updates will need to increase it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

<packaging>nbm</packaging>

<name>Minimum Spanning Tree Plugin</name>

<dependencies>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>graphstore</artifactId>
<version>0.5.3</version>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>statistics-api</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>utils-longtask</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>graph-api</artifactId>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>io-importer-api</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>io-importer-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>io-processor-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-modules-masterfs</artifactId> <!-- See http://wiki.netbeans.org/UsingFileSystemsMasterfs -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>filters-api</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>filters-plugin</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>filters-impl</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
<licenseName>gpl-3.0</licenseName>
<licenseFile>gpl-3.0.txt</licenseFile>
<author>Carl Schroedl carlschroedl@gmail.com</author>
<sourceCodeUrl>https://github.com/carlschroedl/gephi-plugins</sourceCodeUrl>
<homePageUrl>https://github.com/carlschroedl/gephi-plugins/tree/minimum-spanning-tree-plugin</homePageUrl>
<publicPackages>
<publicPackage>com.carlschroedl.gephi.plugin.minimumspanningtree</publicPackage>
</publicPackages>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>

@carlschroedl carlschroedl Dec 18, 2016

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, when triggering code coverage collection in the NetBeans UI, it disgregards the version of the coverage plugin that is specified in the pom. Instead, NetBeans uses the most recent stable release of the plugin. In this case, there are integration problems between NetBeans 8.2 and the most recent stable release of the cobertura-maven-plugin (2.7). By running the cover.sh script I included above, a user can at least view their code lines painted in red, yellow, or green depending on test coverage. While you can't trigger the collection of code coverage data via the NetBeans UI, you can still view the results in NetBeans.

</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.carlschroedl.gephi.plugin.minimumspanningtree;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.Node;
import org.gephi.graph.impl.utils.MapDeepEquals;
import org.openide.util.Pair;

/**
* This class determines whether two graphs have the same nodes and edges. Nodes
* from different graphs are considered equal if and only if their node ids are
* equal. Edges from different graphs are considered equal if and only if their
* source node ids, target node ids, and weights are equal. Two graphs are equal
* if and only if all of their nodes and edges are equal, and they have the same
* number of edges and nodes.
* All other node and edge attributes are ignored in this comparison.
*/
public class GraphTopologyEquals {

@carlschroedl carlschroedl Dec 18, 2016

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this because I wanted my plugin's tests to assert that the result of running the algorithm was the same as a manually-verified graph loaded from file. Since I'm new to Gephi, I'm wondering if this is necessary. Are there any alternatives built in to Gephi for determining if graphs have equal topologies?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there are builtin methods for this, but this is a small class. Great that you have tests!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Cool. Thanks for confirming that I'm not duplicating existing Gephi functionality.


private static Pair getSourceTargetPair(Edge e) {
Object aSourceId = e.getSource().getId();
Object aTargetId = e.getTarget().getId();
Pair<Object, Object> pair = Pair.of(aSourceId, aTargetId);
return pair;

}
/**
* Compares edge collections based on source node id , target node id, and edge weight.
* @param aEdgeCollection
* @param bEdgeCollection
* @return true if all edges in both collections match, otherwise false.
*/
public static boolean edgeCollectionsAreEqual(Collection<Edge> aEdgeCollection, Collection<Edge> bEdgeCollection) {
boolean equal = true;
if (aEdgeCollection.size() == bEdgeCollection.size()) {
Map<Pair<Object, Object>, Double> aEdgeMap = new HashMap<Pair<Object, Object>, Double>();
for (Edge aEdge : aEdgeCollection) {
double weight = aEdge.getWeight();
aEdgeMap.put(getSourceTargetPair(aEdge), weight);
}

Map<Pair<Object, Object>, Double> bEdgeMap = new HashMap<Pair<Object, Object>, Double>();
for (Edge bEdge : bEdgeCollection) {
double weight = bEdge.getWeight();
bEdgeMap.put(getSourceTargetPair(bEdge), weight);
}

equal = MapDeepEquals.mapDeepEquals(aEdgeMap, bEdgeMap);
} else {
equal = false;
}
return equal;
}

public static boolean graphsHaveSameTopology(Graph a, Graph b) {
boolean equal = true;
a.writeLock();
b.writeLock();
try {
if (a.getNodeCount() == b.getNodeCount() && a.getEdgeCount() == b.getEdgeCount()) {
for (Node aNode : a.getNodes()) {
Node bNode = b.getNode(aNode.getId());
if (null == bNode) {
equal = false;
break;
} else {
Collection<Edge> aEdges = a.getEdges(aNode).toCollection();
Collection<Edge> bEdges = b.getEdges(bNode).toCollection();
if (!edgeCollectionsAreEqual(aEdges, bEdges)) {
equal = false;
break;
}
}
}
} else {
equal = false;
}
} finally {
a.writeUnlock();
b.writeUnlock();
}
return equal;
}

}
Loading