diff --git a/.gitignore b/.gitignore index 153b49dd74..f2fdced513 100644 --- a/.gitignore +++ b/.gitignore @@ -176,3 +176,4 @@ nbdist/ .nb-gradle/ # End of https://www.gitignore.io/api/maven,eclipse,netbeans,intellij + diff --git a/README.md b/README.md index abdba38774..66d23bb2fe 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,209 @@ + +# Gephi Plugins + +This repository is an out-of-the-box development environment for Gephi plugins. Gephi plugins are implemented in Java and can extend [Gephi](https://gephi.org) in many different ways, adding or improving features. Getting started is easy with this repository but also checkout the [Bootcamp](https://github.com/gephi/gephi-plugins-bootcamp) for examples of plugins you can create. + +## Migrate Gephi 0.8 plugins + +The process in which plugins are developed and submitted had an overhaul when Gephi 0.9 was released. Details can be read on this article: [Plugin development gets new tools and opens-up to the community](https://gephi.wordpress.com/2015/12/16/plugin-development-gets-new-tools-and-opens-up-to-the-community/). + +This section is a step-by-step guide to migrate 0.8 plugins. Before going through the code and configuration, let's summerize the key differences between the two environements. + +- The 0.8 base is built using Ant, whereas the 0.9 uses Maven. These two are significantly different. If you aren't familiar with Maven, you can start with [Maven in 5 Minutes]( https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). Maven configurations are defined in the `pom.xml` files. +- The 0.8 base finds the Gephi modules into the `platform` folder checked in the repository, whereas the 0.9 base downloads everything from the central Maven repository, where all Gephi modules are available. +- Maven requires to separate source files (e.g. .java) and resources files (e.g. .properties) into distinct folders. Sources are located in `src/main/java` and resources in `src/main/resources`. + +A custom `migrate` goal is available in the [Gephi Maven Plugin](https://github.com/gephi/gephi-maven-plugin) to facilitate the migration from 0.8 to 0.9. This automated process migrates ant-based plugins to maven and takes care of copying the configuration and code. Follow these steps to migrate your plugin: + +- Fork and checkout this repository: + + git clone git@github.com:username/gephi-plugins.git + +If you've already had a forked repository based on 0.8 we suggest to save your code somewhere, delete it and fork again as the history was cleared. + +- Copy your plugin folder at the root of this directory. + +- Run this command: + + mvn org.gephi:gephi-maven-plugin:migrate + +This command will detect the ant-based plugin and migrate it. The resulting folder is then located into the `modules` folder. + +The plugin code can then be inspected in Netbeans or built via command line with `mvn clean package`. + +## Get started + +### Requirements + +Developing Gephi plugins requires [JDK 7](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or later and [Maven](http://maven.apache.org/). Although any IDE/Editor can be used, [Netbeans IDE](https://netbeans.org/) is recommend as Gephi itself is based on [Netbeans Platform](https://netbeans.org/features/platform/index.html). + +### Create a plugin + +The creation of a new plugin is simple thanks to our custom [Gephi Maven Plugin](https://github.com/gephi/gephi-maven-plugin). The `generate` goal asks a few questions and then configures everything for you. + +- Fork and checkout the latest version of this repository: + + git clone git@github.com:username/gephi-plugins.git +- Run the following command and answer the questions: + + mvn org.gephi:gephi-maven-plugin:generate + +This is an example of what this process will ask: + + Name of organization (e.g. my.company): org.foo + Name of artifact (e.g my-plugin): my-plugin + Version (e.g. 1.0.0): 1.0.0 + Directory name (e.g MyPlugin): MyPlugin + Branding name (e.g My Plugin): My Plugin + Category (e.g Layout, Filter, etc.): Layout + Author: My Name + Author email (optional): + Author URL (optional): + License (e.g Apache 2.0): Apache 2.0 + Short description (i.e. one sentence): Plugin catch-phrase + Long description (i.e multiple sentences): Plugin features are great + Would you like to add a README.md file (yes|no): yes + +The plugin configuration is created. Now you can (in any order): + +- Add some Java code in the `src/main/java` folder of your plugin +- Add some resources (e.g. Bundle.properties, images) into the `src/main/resources/` folder of your plugin +- Change the version, author or license information into the `pom.xml` file, which is in your plugin folder +- Edit the description or category details into the `src/main/nbm/manifest.mf` file in your plugin folder + +### Build a plugin + +Run the following command to compile and build your plugin: + + mvn clean package + +In addition of compiling and building the JAR and NBM, this command uses the `Gephi Maven Plugin` to verify the plugin's configuration. In care something is wrong it will fail and indicte the reason. + +### Run Gephi with plugin + +Run the following command to run Gephi with your plugin pre-installed. Make sure to run `mvn package` beforehand to rebuild. + + mvn org.gephi:gephi-maven-plugin:run + +In Gephi, when you navigate to `Tools` > `Plugins` you should see your plugin listed in `Installed`. + +## Submit a plugin + +Submitting a Gephi plugin for approval is a simple process based on GitHub's [pull request](https://help.github.com/articles/using-pull-requests/) mechanism. + +- First, make sure you're working on a fork of [gephi-plugins](https://github.com/gephi/gephi-plugins). You can check that by running `git remote -v` and look at the url, it should contain your GitHub username, for example `git@github.com:username/gephi-plugins.git`. + +- Add and commit your work. It's recommended to keep your fork synced with the upstream repository, as explained [here](https://help.github.com/articles/syncing-a-fork/), so you can run `git merge upstream/master` beforehand. + +- Push your commits to your fork with `git push origin master`. + +- Navigate to your fork's URL and create a pull request. Select `master-forge` instead of `master` as base branch. + +- Submit your pull request. + +## Update a plugin + +Updating a Gephi plugin has the same process as submiting it for the first time. Don't forget to merge from upstream's master branch. + +## IDE Support + +### Netbeans IDE + +- Start Netbeans and go to `File` and then `Open Project`. Navigate to your fork repository, Netbeans automatically recognizes it as Maven project. +- Each plugin module can be found in the `Modules` folder. + +To run Gephi with your plugin pre-installed, right click on the `gephi-plugins` project and select `Run`. + +To debug Gephi with your plugin, right click on the `gephi-plugins` project and select `Debug`. + +### IntelliJ IDEA + +- Start IntelliJ and `Open` the project by navigating to your fork repository. IntelliJ may prompt you to import the Maven project, select yes. + +To run Gephi with your plugin pre-installed when you click `Run`, create a `Maven` run configuration and enter `org.gephi:gephi-maven-plugin:run` in the command field. The working directory is simply the current project directory. + +To debug Gephi with your plugin, create a `Remote` configuration and switch the `Debugger mode` option to `Listen`. Then create a `Maven` run configuration like abobe but add `-Drun.params.debug="-J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,suspend=n,server=n,address=5005"` into the `Runner` > `VM Options` field. Then, go to the `Run` menu and first run debug with the remote configuration and then only run debug with the Maven configuration. + +## FAQ + +#### What kind of plugins can I create? + +Gephi can be extended in many ways but the major categories are `Layout`, `Export`, `Import`, `Data Laboratory`, `Filter`, `Generator`, `Metric`, `Preview`, `Tool`, `Appearance` and `Clustering`. A good way to start is to look at examples with the [bootcamp](https://github.com/gephi/gephi-plugins-bootcamp). + +#### In which language can plugins be created? + +Plugins can use any JVM languages (e.g. Scala, Python, Groovy) but the default option is Java. + +#### Can native librairies be used? + +Yes, native librairies can be used in modules. + +#### How is this repository structured? + +The `modules` folder is where plugin modules go. Each plugin is defined in a in single folder in this directory. A plugin can be composed of multiple modules (it's called a suite then) but usually one is enough to do what you want. + +The `pom.xml` file in `modules` is the parent pom for plugins. A Maven pom can inherit configurations from a parent and that is something we use to keep each plugin's pom very simple. Notice that each plugin's pom (i.e. the `pom.xml` file in the plugin folder) has a `` defined. + +The `pom.xml` file at the root folder makes eveything fit together and notably lists the modules. + +#### How are the manifest settings defined? + +There are two options. The first option is what the `generate` task does: it puts entries `OpenIDE-Module-Short-Description`, `OpenIDE-Module-Long-Description`, `OpenIDE-Module-Display-Category` and `OpenIDE-Module-Name` into the `src/main/nbm/manifest.mf` file. The second option sets a ` +OpenIDE-Module-Localizing-Bundle` entry into the `manifest.mf` so values are defined elsewhere in `Bundle.properties` file. The value is then simply the path to the file (e.g. `OpenIDE-Module-Localizing-Bundle: org/project/Bundle.properties`). + +The second option is preferable when the short or long description have too many characters as the manifest format is pretty restrictive. + +#### How to add a new module? + +This applies for suite plugins with multiple modules. Besides creating the module folder, edit the `pom.xml` file and add the folder path to ``, like in this example: + +``` + + + + modules/ExampleModule + +``` + +#### Where are dependencies configured? + +Dependencies are configured in the `` section in the plugin folder's `pom.xml`. Each dependency has a `groupId`, an `artifactId` and a `version`. There are three types of dependencies a plugin can have: an external library, a Gephi module or a Netbeans module. + +The list of Gephi and Netbeans dependencies one can use can be found in the `modules/pom.xml` file. All possible dependencies are listed in the `` section. Because each plugin module inherits from this parent pom the version can be omitted when the dependency is set. For instance, this is how a plugin depends on `GraphAPI` and Netbeans's `Lookup`. + +``` + + + org.netbeans.api + org-openide-util-lookup + + + org.gephi + graph-api + + +``` + +#### What are public packages for? + +This applies for suite plugins with multiple modules. A module should declare the packages it wants to nake accessible to other modules. For instance, if a module `B` depends on the class `my.org.project.ExampleController` defined in a module `A`, the `A` module should declare `my.org.project` as public package. + +Public packages are configured in the module's `pom.xml` file. Edit the `` entry. Example: + +``` + + my.org.project + +``` + +#### What is the difference between plugin and module? + +It's the same thing. We say module because Gephi is a modular application and is composed of many independent modules. Plugins also are modules but we call them plugin because they aren't in the _core_ Gephi. + +#### When running the plugin in Netbeans I get an error "Running standalone modules or suites requires..." + +This error appears when you try to run a module. To run Gephi with your plugin you need to run the `gephi-plugins` project, not your module. +======= # Gephi Plugins This repository is an out-of-the-box development environment for Gephi plugins. Gephi plugins are implemented in Java and can extend [Gephi](https://gephi.org) in many different ways, adding or improving features. Getting started is easy with this repository but also checkout the [Bootcamp](https://github.com/gephi/gephi-plugins-bootcamp) for examples of plugins you can create. @@ -201,3 +407,4 @@ It's the same thing. We say module because Gephi is a modular application and is #### When running the plugin in Netbeans I get an error "Running standalone modules or suites requires..." This error appears when you try to run a module. To run Gephi with your plugin you need to run the `gephi-plugins` project, not your module. + diff --git a/modules/CompetenceRank/pom.xml b/modules/CompetenceRank/pom.xml new file mode 100644 index 0000000000..1c443dfba2 --- /dev/null +++ b/modules/CompetenceRank/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + gephi-plugin-parent + org.gephi + 0.9.2 + + + org.hsmw + competence-rank + 1.0.0 + nbm + + Competence Rank + + + + + org.gephi + statistics-api + 0.9.2 + + + org.gephi + graph-api + 0.9.2 + + + org.gephi + utils-longtask + 0.9.2 + + + org.gephi + statistics-plugin + 0.9.2 + jar + + + org.gephi + core-library-wrapper + 0.9.2 + + + org.swinglabs.swingx + swingx-all + 1.6.5-1 + + + org.netbeans.api + org-openide-util + RELEASE82 + + + + + + + org.codehaus.mojo + nbm-maven-plugin + + Apache 2.0 + Laura Horst + + + $sourcecode_url + + + + + + + + + 1.7 + 1.7 + + + + diff --git a/modules/CompetenceRank/src/main/java/competencerank/CompetenceBuilder.java b/modules/CompetenceRank/src/main/java/competencerank/CompetenceBuilder.java new file mode 100644 index 0000000000..ef408c3620 --- /dev/null +++ b/modules/CompetenceRank/src/main/java/competencerank/CompetenceBuilder.java @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package competencerank; + +import org.gephi.statistics.spi.Statistics; +import org.gephi.statistics.spi.StatisticsBuilder; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Laura + */ +@ServiceProvider(service = StatisticsBuilder.class) +public class CompetenceBuilder implements StatisticsBuilder{ + + @Override + public String getName() { + return "CompetenceRank"; //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Statistics getStatistics() { + return new CompetenceRank(); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Class getStatisticsClass() { + return CompetenceRank.class; //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.form b/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.form new file mode 100644 index 0000000000..49f499eac6 --- /dev/null +++ b/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.form @@ -0,0 +1,116 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.java b/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.java new file mode 100644 index 0000000000..1a78b56b9a --- /dev/null +++ b/modules/CompetenceRank/src/main/java/competencerank/CompetencePanel.java @@ -0,0 +1,99 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package competencerank; + +/** + * + * @author Laura + */ +public class CompetencePanel extends javax.swing.JPanel { + + /** + * Creates new form CompetencePanel + */ + public CompetencePanel() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jXHeader1 = new org.jdesktop.swingx.JXHeader(); + jXLabel1 = new org.jdesktop.swingx.JXLabel(); + jLabel2 = new javax.swing.JLabel(); + jXLabel2 = new org.jdesktop.swingx.JXLabel(); + jXLabel3 = new org.jdesktop.swingx.JXLabel(); + + setPreferredSize(new java.awt.Dimension(500, 300)); + + jXHeader1.setDescription(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jXHeader1.description_1")); // NOI18N + jXHeader1.setTitle(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jXHeader1.title_1")); // NOI18N + + jXLabel1.setText(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jXLabel1.text")); // NOI18N + jXLabel1.setLineWrap(true); + + jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/competencerank/formel2.PNG"))); // NOI18N + jLabel2.setText(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jLabel2.text")); // NOI18N + + jXLabel2.setText(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jXLabel2.text")); // NOI18N + jXLabel2.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N + jXLabel2.setLineWrap(true); + + jXLabel3.setText(org.openide.util.NbBundle.getMessage(CompetencePanel.class, "CompetencePanel.jXLabel3.text")); // NOI18N + jXLabel3.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jXHeader1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jXLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(147, 147, 147) + .addComponent(jLabel2)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jXHeader1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jXLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2) + .addGap(3, 3, 3) + .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(74, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel2; + private org.jdesktop.swingx.JXHeader jXHeader1; + private org.jdesktop.swingx.JXLabel jXLabel1; + private org.jdesktop.swingx.JXLabel jXLabel2; + private org.jdesktop.swingx.JXLabel jXLabel3; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/CompetenceRank/src/main/java/competencerank/CompetenceRank.java b/modules/CompetenceRank/src/main/java/competencerank/CompetenceRank.java new file mode 100644 index 0000000000..e8a9a3be37 --- /dev/null +++ b/modules/CompetenceRank/src/main/java/competencerank/CompetenceRank.java @@ -0,0 +1,232 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package competencerank; + +import java.util.Arrays; +import java.util.List; +import org.gephi.graph.api.Column; +import org.gephi.graph.api.Edge; +import org.gephi.graph.api.Graph; +import org.gephi.graph.api.GraphModel; +import org.gephi.graph.api.Node; +import org.gephi.graph.api.Origin; +import org.gephi.graph.api.Table; +import org.gephi.statistics.plugin.ChartUtils; +import org.gephi.statistics.spi.Statistics; +import org.gephi.utils.longtask.spi.LongTask; +import org.gephi.utils.progress.Progress; +import org.gephi.utils.progress.ProgressTicket; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PlotOrientation; +import org.gephi.graph.api.DirectedGraph; +import org.jfree.data.statistics.HistogramDataset; +import org.jfree.data.statistics.HistogramType; + +/** + * + * @author Laura Horst, Michael Spranger (AG FoSIL - University of Applied Sciences Mittweida, Germany ) + */ +public class CompetenceRank implements Statistics, LongTask { + + //initialize global variables + private String report; + private boolean cancel = false; + private ProgressTicket progressTicket; + private double[] compr; + private boolean isDirected; + + @Override + public void execute(GraphModel gm) { + + report += "Calculation of CompetenceRank started"; + Graph graph = gm.getGraphVisible(); + isDirected = graph.isDirected(); + graph.readLock(); + + //examine wether the graph has directed edges + try { + DirectedGraph directedGraph = null; + + if (isDirected) { + directedGraph = (DirectedGraph) graph; + } + else + { + throw new Exception("Graph is not directed."); + } + Progress.start(progressTicket); + + //initialize local variables + List nodeList = Arrays.asList(graph.getNodes().toArray()); + int[][] transitionMatrix = new int[graph.getNodeCount()][graph.getNodeCount()]; + compr = new double[graph.getNodeCount()]; + int[][] adjacencyMatrix = new int[graph.getNodeCount() + 1][graph.getNodeCount() + 1]; + double[][] weightedAdjacencyMatrix = new double[graph.getNodeCount() + 1][graph.getNodeCount() + 1]; + int[] rowsums = new int[adjacencyMatrix.length]; + + //beginning of calculating the LeaderRank + for (int i = 0; i < rowsums.length - 1; i++) { + rowsums[i] = 1; + } + rowsums[rowsums.length - 1] = adjacencyMatrix.length - 1; + for (Edge e : graph.getEdges()) { + int sourceIndex = nodeList.indexOf(e.getSource()); + int targetIndex = nodeList.indexOf(e.getTarget()); + transitionMatrix[sourceIndex][targetIndex]++; + if (adjacencyMatrix[sourceIndex][targetIndex] == 0) { + if (sourceIndex != targetIndex) { + adjacencyMatrix[sourceIndex][targetIndex] = 1; + rowsums[sourceIndex]++; + } + } + + } + if (cancel) { + return; + } + for (int i = 0; i < adjacencyMatrix.length; i++) { + int value = (graph.getNodeCount() == i) ? 0 : 1; + adjacencyMatrix[graph.getNodeCount()][i] = value; + adjacencyMatrix[i][graph.getNodeCount()] = value; + } + + for (int i = 0; i < adjacencyMatrix.length; i++) { + for (int j = 0; j < adjacencyMatrix.length; j++) { + weightedAdjacencyMatrix[j][i] = (double) adjacencyMatrix[i][j] / rowsums[i]; + } + } + + double[] score_t = new double[adjacencyMatrix.length]; + for (int i = 0; i < adjacencyMatrix.length - 1; i++) { + score_t[i] = 1; + } + if (cancel) { + return; + } + + score_t[score_t.length - 1] = 0; + + double error_t = 0.00002; + double error = 1; + + while (error > error_t) { + double[] score_copy = Arrays.copyOf(score_t, score_t.length); + + for (int i = 0; i < adjacencyMatrix.length; i++) { + double score_i = 0; + for (int j = 0; j < adjacencyMatrix.length; j++) { + score_i += weightedAdjacencyMatrix[i][j] * score_copy[j]; + } + score_t[i] = score_i; + } + + error = 0; + for (int i = 0; i < score_t.length; i++) { + error += Math.abs(score_copy[i] - score_t[i]); + + } + error = error / transitionMatrix.length; + + if (cancel) { + return; + } + } + double score_gn = score_t[score_t.length - 1]; + + + double[] score_uncor = Arrays.copyOfRange(score_t, 0, score_t.length - 1); + //ending of calculating the LeaderRank + + //add a Column for CompetenceRank to the table in Data Laboratory + Table nodeTable = gm.getNodeTable(); + Column crCol = nodeTable.getColumn("CompetenceRank"); + if (crCol == null) { + crCol = nodeTable.addColumn("CompetenceRank", Double.class, Origin.DATA); + } + + //add up all outging edges in the graph + int ktotal = 0; + for (int i = 0; i
" + + "

Results:

" + + imageFile //add image of histogram + + "

" + "

Algorithm:

" + + "Michael Spranger, Florian Heinke, Hanna Siewerts, Joshua Hampl, Dirk Labudde Opinion Leader in Star-Like Social Networks: A Simple Case?, in The Eighth International Conference on Advances in Information Mining and Management (IMMM 2018), 2018
" + + " "; + return report; + } + + @Override + public boolean cancel() { + cancel = true; + return true; + } + + @Override + public void setProgressTicket(ProgressTicket pt) { + this.progressTicket = pt; + } + +} diff --git a/modules/CompetenceRank/src/main/java/competencerank/CompetenceUI.java b/modules/CompetenceRank/src/main/java/competencerank/CompetenceUI.java new file mode 100644 index 0000000000..f57997d814 --- /dev/null +++ b/modules/CompetenceRank/src/main/java/competencerank/CompetenceUI.java @@ -0,0 +1,80 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package competencerank; + +import javax.swing.JPanel; +import org.gephi.statistics.spi.Statistics; +import org.gephi.statistics.spi.StatisticsUI; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author Laura + */ +@ServiceProvider(service = StatisticsUI.class) +public class CompetenceUI implements StatisticsUI{ + + private CompetencePanel panel; + + //return panel + @Override + public JPanel getSettingsPanel() { + panel = new CompetencePanel(); + return panel; + } + + //empty beacause algorithm does not use parameters + @Override + public void setup(Statistics statistics) { + if(panel!=null){ + } + } + + //empty beacause algorithm does not use parameters + @Override + public void unsetup() { + if(panel!=null){ + } + panel=null; + } + + //return statistics' class the UI belongs to + @Override + public Class getStatisticsClass() { + return CompetenceRank.class; + } + + //null because algorithm does not have single value result + @Override + public String getValue() { + return null; + } + + //name which is shown in Statistics + @Override + public String getDisplayName() { + return "CompetenceRank"; + } + + //fill short description + @Override + public String getShortDescription() { + return "Calculates the CompetenceRank."; + } + + //algorithm should be placed in category 'Network' + @Override + public String getCategory() { + return StatisticsUI.CATEGORY_NETWORK_OVERVIEW; + } + + //position of the statistic in the UI + @Override + public int getPosition() { + return 800; + } + +} diff --git a/modules/CompetenceRank/src/main/nbm/manifest.mf b/modules/CompetenceRank/src/main/nbm/manifest.mf new file mode 100644 index 0000000000..dc3acf62e4 --- /dev/null +++ b/modules/CompetenceRank/src/main/nbm/manifest.mf @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Name: Competence Rank +OpenIDE-Module-Short-Description: Plugin +OpenIDE-Module-Long-Description: Plugin +OpenIDE-Module-Display-Category: Metric diff --git a/modules/CompetenceRank/src/main/resources/competencerank/Bundle.properties b/modules/CompetenceRank/src/main/resources/competencerank/Bundle.properties new file mode 100644 index 0000000000..3834f0fafc --- /dev/null +++ b/modules/CompetenceRank/src/main/resources/competencerank/Bundle.properties @@ -0,0 +1,9 @@ + +CompetencePanel.jXHeader1.title=CompetenceRank +CompetencePanel.jXHeader1.description=The algorithm detects leaders in star-like topologies. +CompetencePanel.jXHeader1.description_1=The algorithm detects leaders in star-like topologies. +CompetencePanel.jXHeader1.title_1=CompetenceRank +CompetencePanel.jXLabel1.text=The detection of opinion leaders is of great interest in forensic applications. The CompetenceRank is specified for star-like social graph topology like Facebook pages with one or a few central actor(s). The algorithm is based on the LeaderRank. In comparison the CompetenceRank down ranks nodes with high amount of out-links in comparison to their in-links.\nCalculation of the CompetenceRank: +CompetencePanel.jLabel2.text= +CompetencePanel.jXLabel2.text=Michael Spranger, Florian Heinke, Hanna Siewerts, Joshua Hampl und Dirk Labudde. Opinion Leaders in Star-Like Social Networks: A simple Case?, in The Eighth International Conference on Advances in Information Mining and Management (IMMM 2018), 2018 +CompetencePanel.jXLabel3.text=Source: diff --git a/modules/CompetenceRank/src/main/resources/competencerank/formel2.PNG b/modules/CompetenceRank/src/main/resources/competencerank/formel2.PNG new file mode 100644 index 0000000000..ec2c55340c Binary files /dev/null and b/modules/CompetenceRank/src/main/resources/competencerank/formel2.PNG differ diff --git a/modules/pom.xml b/modules/pom.xml index 3d3cbfaa18..6a04d964a9 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -1,623 +1,623 @@ - - - 4.0.0 - - org.gephi - gephi-plugin-parent - 0.9.2 - pom - - gephi-plugins-parent - Parent POM for all Gephi plugins - 2015 - - http://github.com/gephi/gephi-plugins - - - - scm:git:git://github.com/gephi/gephi-plugins.git - scm:git:git@github.com:gephi/gephi-plugins.git - https://github.com/gephi/gephi-plugins - - - - - - Apache 2.0 - http://www.opensource.org/licenses/Apache-2.0 - Apache License, Version 2.0 - - - - - - - mbastian - Mathieu Bastian - mathieu.bastian@gephi.org - - - eduramiba - Eduardo Ramos - eduardo.ramos@gephi.org - - - - - - UTF-8 - 0.9.2 - RELEASE82 - - - - - - oss-sonatype - oss-sonatype - https://oss.sonatype.org/content/repositories/snapshots/ - - true - - - - netbeans - NetBeans - http://bits.netbeans.org/nexus/content/groups/netbeans/ - - false - - - - - - - - - org.gephi - utils-longtask - ${gephi.version} - - - org.gephi - project-api - ${gephi.version} - - - org.gephi - io-exporter-api - ${gephi.version} - - - org.gephi - graph-api - ${gephi.version} - - - org.gephi - preview-api - ${gephi.version} - - - org.gephi - io-exporter-preview - ${gephi.version} - - - org.gephi - lib.validation - ${gephi.version} - - - org.gephi - preview-export-ui - ${gephi.version} - - - org.gephi - utils - ${gephi.version} - - - org.gephi - datalab-api - ${gephi.version} - - - org.gephi - visualization-api - ${gephi.version} - - - org.gephi - preview-plugin - ${gephi.version} - - - org.gephi - db-drivers - ${gephi.version} - - - org.gephi - io-importer-api - ${gephi.version} - - - org.gephi - io-processor-plugin - ${gephi.version} - - - org.gephi - processor-plugin-ui - ${gephi.version} - - - org.gephi - project-ui - ${gephi.version} - - - org.gephi - ui-utils - ${gephi.version} - - - org.gephi - ui-components - ${gephi.version} - - - org.gephi - settings-upgrader - ${gephi.version} - - - org.gephi - statistics-api - ${gephi.version} - - - org.gephi - statistics-plugin - ${gephi.version} - - - org.gephi - statistics-plugin-ui - ${gephi.version} - - - org.gephi - tools-api - ${gephi.version} - - - org.gephi - algorithms-plugin - ${gephi.version} - - - org.gephi - gleem - ${gephi.version} - - - org.gephi - mostrecentfiles-api - ${gephi.version} - - - org.gephi - desktop-project - ${gephi.version} - - - org.gephi - visualization - ${gephi.version} - - - org.gephi - tools-plugin - ${gephi.version} - - - org.gephi - welcome-screen - ${gephi.version} - - - org.gephi - desktop-context - ${gephi.version} - - - org.gephi - desktop-progress - ${gephi.version} - - - org.gephi - layout-api - ${gephi.version} - - - org.gephi - io-generator-api - ${gephi.version} - - - org.gephi - io-generator-plugin - ${gephi.version} - - - org.gephi - generator-plugin-ui - ${gephi.version} - - - org.gephi - io-exporter-plugin - ${gephi.version} - - - org.gephi - desktop-statistics - ${gephi.version} - - - org.gephi - filters-api - ${gephi.version} - - - org.gephi - layout-plugin - ${gephi.version} - - - org.gephi - desktop-generate - ${gephi.version} - - - org.gephi - desktop-banner - ${gephi.version} - - - org.gephi - desktop-branding - ${gephi.version} - - - org.gephi - appearance-api - ${gephi.version} - - - org.gephi - desktop-appearance - ${gephi.version} - - - org.gephi - io-importer-plugin - ${gephi.version} - - - org.gephi - desktop-datalab - ${gephi.version} - - - org.gephi - filters-plugin - ${gephi.version} - - - org.gephi - filters-impl - ${gephi.version} - - - org.gephi - export-plugin-ui - ${gephi.version} - - - org.gephi - desktop-recent-files - ${gephi.version} - - - org.gephi - desktop-io-export - ${gephi.version} - - - org.gephi - perspective-api - ${gephi.version} - - - org.gephi - import-plugin-ui - ${gephi.version} - - - org.gephi - filters-plugin-ui - ${gephi.version} - - - org.gephi - datalab-plugin - ${gephi.version} - - - org.gephi - desktop-layout - ${gephi.version} - - - org.gephi - desktop-import - ${gephi.version} - - - org.gephi - desktop-preview - ${gephi.version} - - - org.gephi - appearance-plugin - ${gephi.version} - - - org.gephi - appearance-plugin-ui - ${gephi.version} - - - org.gephi - desktop-tools - ${gephi.version} - - - org.gephi - timeline-api - ${gephi.version} - - - org.gephi - desktop-timeline - ${gephi.version} - - - org.gephi - directory-chooser - ${gephi.version} - - - org.gephi - desktop-filters - ${gephi.version} - - - org.gephi - core-library-wrapper - ${gephi.version} - - - org.gephi - ui-library-wrapper - ${gephi.version} - - - org.gephi - ui-propertyeditor - ${gephi.version} - - - org.netbeans.api - org-openide-dialogs - ${netbeans.version} - - - org.netbeans.api - org-openide-filesystems - ${netbeans.version} - - - org.netbeans.modules - org-netbeans-modules-masterfs - ${netbeans.version} - - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-util-ui - ${netbeans.version} - - - org.netbeans.api - org-openide-util-lookup - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - - - org.netbeans.api - org-openide-modules - ${netbeans.version} - - - org.netbeans.api - org-netbeans-modules-sendopts - ${netbeans.version} - - - org.netbeans.api - org-netbeans-api-progress - ${netbeans.version} - - - org.netbeans.api - org-netbeans-api-progress-nb - ${netbeans.version} - - - org.netbeans.api - org-openide-nodes - ${netbeans.version} - - - org.netbeans.api - org-openide-awt - ${netbeans.version} - - - org.netbeans.api - org-netbeans-modules-settings - ${netbeans.version} - - - org.netbeans.api - org-netbeans-modules-options-api - ${netbeans.version} - - - org.netbeans.api - org-netbeans-swing-outline - ${netbeans.version} - - - org.netbeans.api - org-openide-explorer - ${netbeans.version} - - - org.netbeans.api - org-netbeans-api-annotations-common - ${netbeans.version} - - - org.netbeans.api - org-netbeans-swing-tabcontrol - ${netbeans.version} - - - org.netbeans.api - org-openide-io - ${netbeans.version} - - - org.netbeans.modules - org-netbeans-core-output2 - ${netbeans.version} - - - org.netbeans.api - org-netbeans-modules-nbjunit - ${netbeans.version} - test - - - - - - - org.codehaus.mojo - nbm-maven-plugin - true - 3.14 - - plugins - - true - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.5 - - true - - - - - - - - - release - - - - org.codehaus.mojo - nbm-maven-plugin - true - - - keystore.ks - gephi - ${keystore.password} - - - - - - - - - release-pom - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.6 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - - - + + + 4.0.0 + + org.gephi + gephi-plugin-parent + 0.9.2 + pom + + gephi-plugins-parent + Parent POM for all Gephi plugins + 2015 + + http://github.com/gephi/gephi-plugins + + + + scm:git:git://github.com/gephi/gephi-plugins.git + scm:git:git@github.com:gephi/gephi-plugins.git + https://github.com/gephi/gephi-plugins + + + + + + Apache 2.0 + http://www.opensource.org/licenses/Apache-2.0 + Apache License, Version 2.0 + + + + + + + mbastian + Mathieu Bastian + mathieu.bastian@gephi.org + + + eduramiba + Eduardo Ramos + eduardo.ramos@gephi.org + + + + + + UTF-8 + 0.9.2 + RELEASE82 + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + netbeans + NetBeans + http://bits.netbeans.org/nexus/content/groups/netbeans/ + + false + + + + + + + + + org.gephi + utils-longtask + ${gephi.version} + + + org.gephi + project-api + ${gephi.version} + + + org.gephi + io-exporter-api + ${gephi.version} + + + org.gephi + graph-api + ${gephi.version} + + + org.gephi + preview-api + ${gephi.version} + + + org.gephi + io-exporter-preview + ${gephi.version} + + + org.gephi + lib.validation + ${gephi.version} + + + org.gephi + preview-export-ui + ${gephi.version} + + + org.gephi + utils + ${gephi.version} + + + org.gephi + datalab-api + ${gephi.version} + + + org.gephi + visualization-api + ${gephi.version} + + + org.gephi + preview-plugin + ${gephi.version} + + + org.gephi + db-drivers + ${gephi.version} + + + org.gephi + io-importer-api + ${gephi.version} + + + org.gephi + io-processor-plugin + ${gephi.version} + + + org.gephi + processor-plugin-ui + ${gephi.version} + + + org.gephi + project-ui + ${gephi.version} + + + org.gephi + ui-utils + ${gephi.version} + + + org.gephi + ui-components + ${gephi.version} + + + org.gephi + settings-upgrader + ${gephi.version} + + + org.gephi + statistics-api + ${gephi.version} + + + org.gephi + statistics-plugin + ${gephi.version} + + + org.gephi + statistics-plugin-ui + ${gephi.version} + + + org.gephi + tools-api + ${gephi.version} + + + org.gephi + algorithms-plugin + ${gephi.version} + + + org.gephi + gleem + ${gephi.version} + + + org.gephi + mostrecentfiles-api + ${gephi.version} + + + org.gephi + desktop-project + ${gephi.version} + + + org.gephi + visualization + ${gephi.version} + + + org.gephi + tools-plugin + ${gephi.version} + + + org.gephi + welcome-screen + ${gephi.version} + + + org.gephi + desktop-context + ${gephi.version} + + + org.gephi + desktop-progress + ${gephi.version} + + + org.gephi + layout-api + ${gephi.version} + + + org.gephi + io-generator-api + ${gephi.version} + + + org.gephi + io-generator-plugin + ${gephi.version} + + + org.gephi + generator-plugin-ui + ${gephi.version} + + + org.gephi + io-exporter-plugin + ${gephi.version} + + + org.gephi + desktop-statistics + ${gephi.version} + + + org.gephi + filters-api + ${gephi.version} + + + org.gephi + layout-plugin + ${gephi.version} + + + org.gephi + desktop-generate + ${gephi.version} + + + org.gephi + desktop-banner + ${gephi.version} + + + org.gephi + desktop-branding + ${gephi.version} + + + org.gephi + appearance-api + ${gephi.version} + + + org.gephi + desktop-appearance + ${gephi.version} + + + org.gephi + io-importer-plugin + ${gephi.version} + + + org.gephi + desktop-datalab + ${gephi.version} + + + org.gephi + filters-plugin + ${gephi.version} + + + org.gephi + filters-impl + ${gephi.version} + + + org.gephi + export-plugin-ui + ${gephi.version} + + + org.gephi + desktop-recent-files + ${gephi.version} + + + org.gephi + desktop-io-export + ${gephi.version} + + + org.gephi + perspective-api + ${gephi.version} + + + org.gephi + import-plugin-ui + ${gephi.version} + + + org.gephi + filters-plugin-ui + ${gephi.version} + + + org.gephi + datalab-plugin + ${gephi.version} + + + org.gephi + desktop-layout + ${gephi.version} + + + org.gephi + desktop-import + ${gephi.version} + + + org.gephi + desktop-preview + ${gephi.version} + + + org.gephi + appearance-plugin + ${gephi.version} + + + org.gephi + appearance-plugin-ui + ${gephi.version} + + + org.gephi + desktop-tools + ${gephi.version} + + + org.gephi + timeline-api + ${gephi.version} + + + org.gephi + desktop-timeline + ${gephi.version} + + + org.gephi + directory-chooser + ${gephi.version} + + + org.gephi + desktop-filters + ${gephi.version} + + + org.gephi + core-library-wrapper + ${gephi.version} + + + org.gephi + ui-library-wrapper + ${gephi.version} + + + org.gephi + ui-propertyeditor + ${gephi.version} + + + org.netbeans.api + org-openide-dialogs + ${netbeans.version} + + + org.netbeans.api + org-openide-filesystems + ${netbeans.version} + + + org.netbeans.modules + org-netbeans-modules-masterfs + ${netbeans.version} + + + org.netbeans.api + org-openide-util + ${netbeans.version} + + + org.netbeans.api + org-openide-util-ui + ${netbeans.version} + + + org.netbeans.api + org-openide-util-lookup + ${netbeans.version} + + + org.netbeans.api + org-openide-windows + ${netbeans.version} + + + org.netbeans.api + org-openide-modules + ${netbeans.version} + + + org.netbeans.api + org-netbeans-modules-sendopts + ${netbeans.version} + + + org.netbeans.api + org-netbeans-api-progress + ${netbeans.version} + + + org.netbeans.api + org-netbeans-api-progress-nb + ${netbeans.version} + + + org.netbeans.api + org-openide-nodes + ${netbeans.version} + + + org.netbeans.api + org-openide-awt + ${netbeans.version} + + + org.netbeans.api + org-netbeans-modules-settings + ${netbeans.version} + + + org.netbeans.api + org-netbeans-modules-options-api + ${netbeans.version} + + + org.netbeans.api + org-netbeans-swing-outline + ${netbeans.version} + + + org.netbeans.api + org-openide-explorer + ${netbeans.version} + + + org.netbeans.api + org-netbeans-api-annotations-common + ${netbeans.version} + + + org.netbeans.api + org-netbeans-swing-tabcontrol + ${netbeans.version} + + + org.netbeans.api + org-openide-io + ${netbeans.version} + + + org.netbeans.modules + org-netbeans-core-output2 + ${netbeans.version} + + + org.netbeans.api + org-netbeans-modules-nbjunit + ${netbeans.version} + test + + + + + + + org.codehaus.mojo + nbm-maven-plugin + true + 3.14 + + plugins + + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.5 + + true + + + + + + + + + release + + + + org.codehaus.mojo + nbm-maven-plugin + true + + + keystore.ks + gephi + ${keystore.password} + + + + + + + + + release-pom + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.6 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + + + diff --git a/nbactions.xml b/nbactions.xml index b7b2cafb76..9afa0a8552 100644 --- a/nbactions.xml +++ b/nbactions.xml @@ -1,21 +1,21 @@ - - - - run - - package - org.gephi:gephi-maven-plugin:run - - - - debug - - package - org.gephi:gephi-maven-plugin:run - - - true - -J-Xdebug -J-Xrunjdwp:transport=dt_socket,suspend=n,server=n,address=${jpda.address} - - - + + + + run + + package + org.gephi:gephi-maven-plugin:run + + + + debug + + package + org.gephi:gephi-maven-plugin:run + + + true + -J-Xdebug -J-Xrunjdwp:transport=dt_socket,suspend=n,server=n,address=${jpda.address} + + + diff --git a/pom.xml b/pom.xml index 838d3f503f..6bb7dbe2cf 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ + modules/CompetenceRank