From 3c10809287d3802f079cec9cd670fb7542b19052 Mon Sep 17 00:00:00 2001 From: qfewzz Date: Sat, 16 Dec 2023 13:19:59 +0330 Subject: [PATCH] final push --- .gitignore | 181 ++++++ CPM_MST.png | Bin 2363 -> 0 bytes README.md | 208 ++++++- build.xml | 8 - manifest.mf | 7 - modules/CPMplugin/README.md | 4 + modules/CPMplugin/pom.xml | 78 +++ .../main/java/com/plugin}/Bundle.properties | 34 +- .../src/main/java/com/plugin}/CPM.java | 544 +++++++++--------- .../src/main/java/com/plugin}/CPMBuilder.java | 59 +- .../src/main/java/com/plugin}/CPMPanel.java | 162 +++--- .../src/main/java/com/plugin}/CPMUI.java | 146 +++-- modules/CPMplugin/src/main/nbm/manifest.mf | 5 + nbactions.xml | 21 + nbproject/build-impl.xml | 45 -- nbproject/genfiles.properties | 8 - nbproject/project.properties | 5 - nbproject/project.xml | 110 ---- nbproject/suite.properties | 1 - pom.xml | 223 +++++++ 20 files changed, 1177 insertions(+), 672 deletions(-) create mode 100644 .gitignore delete mode 100644 CPM_MST.png delete mode 100644 build.xml delete mode 100644 manifest.mf create mode 100644 modules/CPMplugin/README.md create mode 100644 modules/CPMplugin/pom.xml rename {src/org/urmiauniversity/it/mst/cpm => modules/CPMplugin/src/main/java/com/plugin}/Bundle.properties (97%) rename {src/org/urmiauniversity/it/mst/cpm => modules/CPMplugin/src/main/java/com/plugin}/CPM.java (78%) rename {src/org/urmiauniversity/it/mst/cpm => modules/CPMplugin/src/main/java/com/plugin}/CPMBuilder.java (65%) rename {src/org/urmiauniversity/it/mst/cpm => modules/CPMplugin/src/main/java/com/plugin}/CPMPanel.java (62%) rename {src/org/urmiauniversity/it/mst/cpm => modules/CPMplugin/src/main/java/com/plugin}/CPMUI.java (89%) create mode 100644 modules/CPMplugin/src/main/nbm/manifest.mf create mode 100644 nbactions.xml delete mode 100644 nbproject/build-impl.xml delete mode 100644 nbproject/genfiles.properties delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml delete mode 100644 nbproject/suite.properties create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6eb5d99 --- /dev/null +++ b/.gitignore @@ -0,0 +1,181 @@ +.DS_Store +**/target/** + +# Created by https://www.gitignore.io/api/maven,eclipse,netbeans,intellij +# Edit at https://www.gitignore.io/?templates=maven,eclipse,netbeans,intellij + +### Eclipse ### + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +*.iml +.idea/ +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +### NetBeans ### +**/nbproject/private/ +**/nbproject/Makefile-*.mk +**/nbproject/Package-*.bash +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +# End of https://www.gitignore.io/api/maven,eclipse,netbeans,intellij + +.java-version \ No newline at end of file diff --git a/CPM_MST.png b/CPM_MST.png deleted file mode 100644 index 040862627d513e49ae272a4c35624216b48f35c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2363 zcmV-B3B>k^P)>^%ciI=iZswH_KbzV3nFE1uX1Vt=eT*tBq|%qlDCe8dD0$ z?$)GDXrqRvCdOJDV0o-G##bM)SfDo5SYUT*wsBY}5P1l$zzS-4hJ{_$otb-or+?f# za(8xSSXTs^aFR)Gevk7z-`{!v2L8`UG7WaZ@I1Ij;3^4cxfa}v49EBnSe@Zcl!}x$8zw;TlorZw`t&rCRV;#85zzPHH{+d?~L4IIw zy@5^zb>ZjP02p}Afbn@elj-JL3>@fyq1l*3!8Q<8&?J02HJ*TLea7!)+uH#{4K(`e z-VEIAPYtZ`HMKeifOib+^?}YvpM2R@;SbN{Gzpksz&LPEYOEaw`GRfFwf8s_8#oXY z!iBj8UNW%LKx>YR``Ex*U(V^NIV%ab2+US!3c(xa0uX_nK!XG{5R z@j%*iOkiv#3%Cic1$L9+9Lt7U0EL%&8@d$M07Lo`_7t}GpVy>~#{lx7JbjN1WxytH zSsDOfx`JtkzxGxL7yjk>eV+it&nmMU&zLVzd4^bDZn6Oouz{BT(AHZaBCyMb=lTM` zf-(N*$HDP+uv?)W@3zyatjhynGHC!{+Xc*=(|t{>50209gxj1BpcV3fqGC9f&4d6x zy%54D;a1>Yg;SldGQ*OXz@RR#0svqnOa``|4VW1K=oc`bzR)5N7iQV;H@t8=s|1c` zi1jgmaKH~NC{H%`Vi0J$vp!T@Wks%&ZLf zvu|=`E-cTcfsntb_&fo~6R+Nh_(fU=a8ltZ2mT#_9l16a!!ZN<=^lwDwx0FTtQzQd zo&X%QVCI+Pu?e_)3xvJ~g+S+cNMr+$a^mrqN`0@MBNtAD3H@NIADPH$LU;==2{I6~ z&Su|%0SC^k0fnT%@PrqxE;_Zsc7-m1a)I(>cZbgyM%VhPm~$xr@a=t@@5tlwJ*UpD z0T=50?}y`Q1y(PTQYyR3myp@c(Avg;2^kV>PYr~jN#R9-{4l)er|xqVa|^9N`xk+d zvu)}ZrhIr=uXpO?pvo~{~b6`2`` zHA<8Z&UBpl`wOM9lhw|&d+I`sYXRnccFQQS@_JQ7wx5)PuMS(Ev0@HoMHaH|3|qPw zY^pmeM%5KYKk3$17P>1$tElxXN%M-at43p{C-C+c0#Ii+EU7V7KNfTt5h+g{ z98ld=0AhG%S!BabfH_;Hgw)p8)R^kJP&D;;^+83nB0A|-`wh?u!RpxFZa#_}_9BFSuG)f0r8f$U+|kti zwxShLH=c0kYalFwo~-+Ivlv~K{sb2OIz)RC8O%2j!{M_9CEG)UyS zZ`!5lbM^VrkATKUPTk<;2$hX2>RH?Lh=y?*EpYk_z^I8SOl48P;VsH6)pvWAwt5sn z>|%X9Gc!{cwo5_)OYM!%_Qrwh3mZONVmJJ;&j3OlY!am3{9oL5O`uj8n{Z@b5BUz{ zy`xI2h&)!~RxM1QUmA)w)EBQmc0R-CIRPy0A3de$o=`{wW~9a@*+czxrweb!N^MU@B#rhgk`KyZtKwT3PbW(N8 z_acZj#py_H4yk?42(rZ9xYBX7Owkq*dGf0O(JKH))(zeXl4M+bl0fOo{!ML4$n<9K z@<`+Et~2H)RowwRUYn@=#svqkdd6z+;nk8GynmO#sM7<$0%zK^O#4@rL{H%8Ln2~n zNFKQ00KD2=VM%VoXd#${bf?UcZph z2a0N(sylM<%SUBTt_ELn)MtIsz_|PWa=!&2T~-X$&g6Tib^wG!j^D^jUZB7`fTb&{ z+ixD6&Zx$%nhg|b+HF~r*sA*KyMqiWpdHGxo hoVeU`UZ$^@{s$gspWvLhOl|-G002ovPDHLkV1j_FT!8=p diff --git a/README.md b/README.md index e2a0137..4b2a7a0 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,201 @@ -# CliquePercolationMethod -Clique Percolation Method (CPM) is a gephi plugin for finding overlapping communities. This method is used for finding overlapping communities, firstly by detecting communities of size k, then forming a clique graph based of cliques of size k. This plugin is designed to work with Gephi and will transform a graph to the clique graph of size k. +# Gephi Plugins -# Algorithm -The algorithm is simple: +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. -1- first find all cliques of size k in the graph -2- then create graph where nodes are cliques of size k -3- add edges if two nodes (cliques) share k-1 common nodes. -4- each connected component is a community +## Get started -# Reference -Palla, Gergely, Imre Derényi, Illés Farkas, and Tamás Vicsek. "Uncovering the overlapping community structure of complex networks in nature and society." Nature 435, no. 7043 (2005): 814-818. +### Requirements + +Developing Gephi plugins requires JDK 11 or later and [Maven](http://maven.apache.org/). + +### 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 to compiling and building the JAR and NBM, this command uses the `Gephi Maven Plugin` to verify the plugin's configuration. In case something is wrong it will fail and indicate 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. If possible, before you submit make sure to [enable edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so that we can help you tweak the code and configuration when needed. + +## Update a plugin + +Updating a Gephi plugin has the same process as submitting it for the first time. Don't forget to merge from upstream's master branch. + +Also, make sure to increment the version number of your plugin in your module's `pom.xml` file before submitting. + +## 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. + +When you make changes to your plugin and want to run Gephi with the changes, make sure to build the `gephi-plugins` root module, and not only your module. Otherwise, your changes won't be reflected. + +## 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` and `Appearance`. 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 libraries be used? + +Yes, native libraries can be used in modules. + +#### How is this repository structured? + +The `modules` folder is where plugin modules go. Each plugin is defined in a 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. + +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 everything fit together and notably lists the modules. No need to change anything there besides the `...` list. + +#### 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 parent POM, which you can browse [here](https://github.com/gephi/gephi-plugins/blob/6136ba8427349aa16c4f4b94265267fc3de0e767/modules/pom.xml#L76). All possible dependencies are listed in the `` section. Because each plugin module already inherits the version from this parent pom, it can be omitted. 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 + + +``` + +#### How to best write unit tests for my plugin? + +It's recommended to use unit-testing to ensure a reliable plugin. + +A JUnit4 dependency can be added to your module's `pom.xml` + +``` + + org.netbeans.api + org-netbeans-modules-nbjunit + test + +``` + +Those tests will automatically be run when your plugin is built. + +#### What are public packages for? + +This applies for suite plugins with multiple modules. A module should declare the packages it wants to make 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. + +## Best practices + +### Code quality + +- Write your code in English, so it can be best reviewed and maintained. \ No newline at end of file diff --git a/build.xml b/build.xml deleted file mode 100644 index 46655f9..0000000 --- a/build.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project org.urmiauniversity.it.mst.cpm. - - diff --git a/manifest.mf b/manifest.mf deleted file mode 100644 index e457027..0000000 --- a/manifest.mf +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -AutoUpdate-Show-In-Client: true -OpenIDE-Module: org.urmiauniversity.it.mst.cpm -OpenIDE-Module-Localizing-Bundle: org/urmiauniversity/it/mst/cpm/Bundle.properties -OpenIDE-Module-Requires: org.openide.windows.WindowManager -OpenIDE-Module-Specification-Version: 1.0 - diff --git a/modules/CPMplugin/README.md b/modules/CPMplugin/README.md new file mode 100644 index 0000000..dfba562 --- /dev/null +++ b/modules/CPMplugin/README.md @@ -0,0 +1,4 @@ +## CPM plugin + +This README supports Markdown, see [syntax](https://help.github.com/articles/markdown-basics/) + diff --git a/modules/CPMplugin/pom.xml b/modules/CPMplugin/pom.xml new file mode 100644 index 0000000..72b9191 --- /dev/null +++ b/modules/CPMplugin/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + gephi-plugin-parent + org.gephi + 0.10.0 + + + my.company + cpm-plugin + 1.0.0 + nbm + + CPM plugin + + + + org.gephi + gephi-toolkit + 0.10.0 + + + org.netbeans.api + org-openide-util-lookup + RELEASE160 + + + org.gephi + utils-longtask + 0.10.0 + + + org.gephi + graph-api + 0.10.0 + + + org.gephi + statistics-api + 0.10.0 + + + + + + + org.apache.netbeans.utilities + nbm-maven-plugin + + Apache 2.0 + Ebrahim Shami + qsomeis@gmail.com + + https://github.com/qfewzz/gephi-plugins + + + + + + + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + diff --git a/src/org/urmiauniversity/it/mst/cpm/Bundle.properties b/modules/CPMplugin/src/main/java/com/plugin/Bundle.properties similarity index 97% rename from src/org/urmiauniversity/it/mst/cpm/Bundle.properties rename to modules/CPMplugin/src/main/java/com/plugin/Bundle.properties index 831fff1..c11c4b7 100644 --- a/src/org/urmiauniversity/it/mst/cpm/Bundle.properties +++ b/modules/CPMplugin/src/main/java/com/plugin/Bundle.properties @@ -1,17 +1,17 @@ -OpenIDE-Module-Display-Category=Tools -OpenIDE-Module-Long-Description=\ - Simple algorithm for detecting overlapping communities based on node centeric method. \ - The main reference is: G. \ - Palla, I. \ - Der\u00e9nyi, I. \ - Farkas, and T. \ - Vicsek. \ - Uncovering the overlapping community structure of complex networks in nature and society. \ - Nature, 435:814\u2013818, 2005. \ - DOI: 10.1038/nature0360733, 78 -OpenIDE-Module-Name=Clique Percolation Method -OpenIDE-Module-Short-Description=Clique Percolation Method implementation -CPM_MSTTopComponent.jTextField1.text=jTextField1 -CPM_MSTTopComponent.jLabel1.text=Size of k: -CPM_MSTTopComponent.jLabel1.toolTipText=K is the clique size which is the new clluster will be based on it. -CPM_MSTTopComponent.jButton1.text=Start +OpenIDE-Module-Display-Category=Tools +OpenIDE-Module-Long-Description=\ + Simple algorithm for detecting overlapping communities based on node centeric method. \ + The main reference is: G. \ + Palla, I. \ + Der\u00e9nyi, I. \ + Farkas, and T. \ + Vicsek. \ + Uncovering the overlapping community structure of complex networks in nature and society. \ + Nature, 435:814\u2013818, 2005. \ + DOI: 10.1038/nature0360733, 78 +OpenIDE-Module-Name=Clique Percolation Method +OpenIDE-Module-Short-Description=Clique Percolation Method implementation +CPM_MSTTopComponent.jTextField1.text=jTextField1 +CPM_MSTTopComponent.jLabel1.text=Size of k: +CPM_MSTTopComponent.jLabel1.toolTipText=K is the clique size which is the new clluster will be based on it. +CPM_MSTTopComponent.jButton1.text=Start diff --git a/src/org/urmiauniversity/it/mst/cpm/CPM.java b/modules/CPMplugin/src/main/java/com/plugin/CPM.java similarity index 78% rename from src/org/urmiauniversity/it/mst/cpm/CPM.java rename to modules/CPMplugin/src/main/java/com/plugin/CPM.java index 9a920f9..dbf65fb 100644 --- a/src/org/urmiauniversity/it/mst/cpm/CPM.java +++ b/modules/CPMplugin/src/main/java/com/plugin/CPM.java @@ -1,267 +1,277 @@ -/* - * 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 org.urmiauniversity.it.mst.cpm; - -import java.util.Collection; -import java.util.Comparator; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; -import java.util.TreeSet; -import java.util.Vector; -import org.gephi.data.attributes.api.AttributeModel; -import org.gephi.graph.api.Edge; -import org.gephi.graph.api.Graph; -import org.gephi.graph.api.GraphController; -import org.gephi.graph.api.GraphModel; -import org.gephi.graph.api.Node; -import org.gephi.utils.longtask.spi.LongTask; -import org.gephi.utils.progress.ProgressTicket; -import org.openide.util.Lookup; - -/** - * - * @author Account - */ -public class CPM implements org.gephi.statistics.spi.Statistics, LongTask { - - private String report = ""; - private boolean cancel = false; - - private ProgressTicket progressTicket; - private int k = 0; - private Set> Cliques = new HashSet>(); - GenQueue> Bk = new GenQueue>(); - - public class SortByID implements Comparator { - - public int compare(Node n1, Node n2) { - if (n1.getId() > n2.getId()) { - return 1; - } else { - return -1; - } - } - } - - // - public Object getLastElement(final Collection c) { - /* - final Iterator itr = c.iterator(); - Object lastElement = itr.next(); - while (itr.hasNext()) { - lastElement = itr.next(); - } - return lastElement; - */ - return null; - } - - class GenQueue { - - private LinkedList list = new LinkedList(); - - public void enqueue(E item) { - list.addLast(item); - } - - public E dequeue() { - return list.pollFirst(); - } - - public boolean hasItems() { - return !list.isEmpty(); - } - - public int size() { - return list.size(); - } - - public void addItems(GenQueue q) { - while (q.hasItems()) { - list.addLast(q.dequeue()); - } - } - } - // - - private Vector getLargerIndexNodes(Graph g, Node vi) { - Vector output = new Vector(); - for (Node n : g.getNodes()) { - if (n.getId() > vi.getId() && g.getEdge(n, vi) != null) { - //TODO check degree of n and vi - output.addElement(n); - } - } - - return output; - } - - private boolean checkBk1IsClique(Graph g, TreeSet Bk1) { - for (Node firstNode : Bk1) { - for (Node secondNode : Bk1) { - if (firstNode == secondNode) { - continue; - } - - if (g.getEdge(firstNode, secondNode) == null) { //One edge is missing in the Bk+1 clique - return false; - } - } - } - - return true; - } - - @Override - public void execute(GraphModel gm, AttributeModel am) { - Graph g = gm.getGraphVisible(); - - g.readLock(); - - //Firstly add each node as an item in Bk - TreeSet tmp; - for (Node n : g.getNodes()) { - //Trick: if the node's degree is less than k-1, it can not involve in k-clique - if (g.getDegree(n) >= k - 1) { - tmp = new TreeSet(new SortByID()); - tmp.add(n); - Bk.enqueue(tmp); //Add the B1 (node itself) to the queue - } - } - - //Now start the iterative process for finding cliques - tmp = Bk.dequeue(); - - while (tmp != null) { - - if (cancel) { - //Empty variables - Bk.list.clear(); - tmp.clear(); - Cliques.clear(); - return; - } - - //Search for Bk+1 - Node vi = tmp.last(); //(Node) getLastElement(tmp); - Vector largerIndexes = getLargerIndexNodes(g, vi); - - for (Node vj : largerIndexes) { - TreeSet Bk1 = new TreeSet(new SortByID()); - Bk1.addAll(tmp); //Clone current Bk into Bk+1 - Bk1.add(vj); - if (Bk1.size() <= getK() && checkBk1IsClique(g, Bk1)) { - - if (Bk1.size() == getK()) { //A clique of size k found. Finish expanding this Bk+1 here. - Cliques.add(Bk1); - } else if (Bk1.size() < getK()) { - Bk.enqueue(Bk1); //k should be checked for finding cliques of size k. - } else { //Clique with larger size will be omitted. - report += "
Larger Clique Found. It should not be here
"; - } - } - } - - tmp = Bk.dequeue(); //Check next item - } - g.readUnlock(); - - //Algorithm finished. - //Write the output - report += "Clique Detection started. Nodes with " + (k - 1) + " edges will not be included."; - report += "

"; - report += "Found Cliques of size " + getK() + ".
Now making new graph ...
Clearing old graph ..."; - - //edit the graph - g.clear(); - report += " [+]
Creating new nodes ..."; - - gm = Lookup.getDefault().lookup(GraphController.class).getModel(); - int nID = 0; - Set nodes = new HashSet(); - - for (Set firstClique : Cliques) { //Create the nodes - Node firstNode = gm.factory().newNode(String.valueOf(nID++)); - String nodeLabel = ""; - - for (Node n : firstClique) { - nodeLabel += n.getNodeData().getLabel() + ","; - } - - nodeLabel = nodeLabel.substring(0, nodeLabel.length() - 1); //remove last , - firstNode.getNodeData().setLabel(nodeLabel); - - nodes.add(firstNode); - } - - report += "[+]
Detecting and creating the edges ..."; - HashSet edges = new HashSet(); - - for (Node vi : nodes) { - for (Node vj : nodes) { - if ((vi != vj) && (getSharedNodes(vi, vj) == k - 1)) { - if (g.getGraphModel().isDirected()) { - edges.add(gm.factory().newEdge(vi, vj, 1.0f, true)); - } else { - edges.add(gm.factory().newEdge(vi, vj, 1.0f, false)); - } - } - } - } - - report += "[+]
Redrawing new graph ..."; - for (Node n : nodes) { - g.addNode(n); - } - - for (Edge e : edges) { - g.addEdge(e); - } - report += "[+]
Done!


Palla, Gergely, Imre Derényi, Illés Farkas, and Tamás Vicsek. \"Uncovering the overlapping community structure of complex networks in nature and society.\" Nature 435, no. 7043 (2005): 814-818"; - } - - private int getSharedNodes(Node vi, Node vj) { - String[] firstCliqueNodes = vi.getNodeData().getLabel().split(","); - String[] secondCliqueNodes = vj.getNodeData().getLabel().split(","); - - int sharedNodes = 0; - - for (String n1 : firstCliqueNodes) { - for (String n2 : secondCliqueNodes) { - if (n1.equals(n2)) { - sharedNodes++; - } - } - } - - return sharedNodes; - } - - @Override - public String getReport() { - return report; - } - - @Override - public boolean cancel() { - cancel = true; - return true; - } - - @Override - public void setProgressTicket(ProgressTicket pt) { - this.progressTicket = pt; - } - - public int getK() { - return k; - } - - public void setK(int k) { - this.k = k; - } -} +package com.plugin; + + +import org.gephi.graph.api.*; +import org.gephi.utils.longtask.spi.LongTask; +import org.gephi.utils.progress.ProgressTicket; +import org.openide.util.Lookup; + +import java.util.*; + + +public class CPM implements org.gephi.statistics.spi.Statistics, LongTask { + + private String report = ""; + private boolean cancel = false; + + private ProgressTicket progressTicket; + private int k = 0; + private Set> Cliques = new HashSet>(); + GenQueue> Bk = new GenQueue>(); + + public class SortByID implements Comparator { + + public int compare(Node n1, Node n2) { + if (n1.getStoreId() > n2.getStoreId()) { + return 1; + } else { + return -1; + } + } + } + + // + public Object getLastElement(final Collection c) { + /* + final Iterator itr = c.iterator(); + Object lastElement = itr.next(); + while (itr.hasNext()) { + lastElement = itr.next(); + } + return lastElement; + */ + return null; + } + + class GenQueue { + + private LinkedList list = new LinkedList(); + + public void enqueue(E item) { + list.addLast(item); + } + + public E dequeue() { + return list.pollFirst(); + } + + public boolean hasItems() { + return !list.isEmpty(); + } + + public int size() { + return list.size(); + } + + public void addItems(GenQueue q) { + while (q.hasItems()) { + list.addLast(q.dequeue()); + } + } + } + // + + private Vector getLargerIndexNodes(Graph g, Node vi) { + Vector output = new Vector(); + for (Node n : g.getNodes()) { + + boolean b1 = n.getStoreId() > vi.getStoreId(), + b2 = g.getEdge(n, vi) != null, + b3 = g.getEdge(vi, n) != null; + + if (b1 && (b2 || b3)) { + output.addElement(n); + } + } + + return output; + } + + private boolean checkBk1IsClique(Graph g, TreeSet Bk1) { + for (Node firstNode : Bk1) { + for (Node secondNode : Bk1) { + if (firstNode == secondNode) { + continue; + } + if (g.getEdge(firstNode, secondNode) == null && + g.getEdge(secondNode, firstNode) == null) { //One edge is missing in the Bk+1 clique + return false; + } + } + } + + return true; + } + + Random r = new Random(); + + @Override + public void execute(GraphModel gm) { + /*for (int i = 0; i < 2; i++) { + Graph graph = gm.getGraphVisible(); + Node node = gm.factory().newNode(); + + node.setLabel(String.valueOf(r.nextInt())); + node.setX(r.nextInt(500)); + node.setY(r.nextInt(500)); + node.setSize(10f); + graph.addNode(node); + }*/ + + + Graph g = gm.getGraphVisible(); + + g.readLock(); + + //Firstly add each node as an item in Bk + int count = 0; + TreeSet tmp; + + for (Node n : g.getNodes()) { + count++; + //Trick: if the node's degree is less than k-1, it can not involve in k-clique + if (g.getDegree(n) >= k - 1) { + tmp = new TreeSet(new SortByID()); + tmp.add(n); + Bk.enqueue(tmp); //Add the B1 (node itself) to the queue + } + } + + //Now start the iterative process for finding cliques + tmp = Bk.dequeue(); + + while (tmp != null) { + if (cancel) { + //Empty variables + Bk.list.clear(); + tmp.clear(); + Cliques.clear(); + return; + } + + //Search for Bk+1 + Node vi = tmp.last(); //(Node) getLastElement(tmp); + Vector largerIndexes = getLargerIndexNodes(g, vi); + + for (Node vj : largerIndexes) { + TreeSet Bk1 = new TreeSet(new SortByID()); + Bk1.addAll(tmp); //Clone current Bk into Bk+1 + Bk1.add(vj); + if (Bk1.size() <= getK() && checkBk1IsClique(g, Bk1)) { + + if (Bk1.size() == getK()) { //A clique of size k found. Finish expanding this Bk+1 here. + Cliques.add(Bk1); + } else if (Bk1.size() < getK()) { + Bk.enqueue(Bk1); //k should be checked for finding cliques of size k. + } else { //Clique with larger size will be omitted. + report += "
Larger Clique Found. It should not be here
"; + } + } + } + + tmp = Bk.dequeue(); //Check next item + } + g.readUnlock(); + + //Algorithm finished. + //Write the output + report += "Clique Detection started. Nodes with " + (k - 1) + " edges will not be included."; + report += "

"; + report += "Found Cliques of size " + getK() + ".
Now making new graph ...
Clearing old graph ..."; + + //edit the graph + g.clear(); + report += " [+]
Creating new nodes ..."; + + gm = Lookup.getDefault().lookup(GraphController.class).getGraphModel(); + int nID = 0; + Set nodes = new HashSet(); + + for (Set firstClique : Cliques) { //Create the nodes + Node firstNode = gm.factory().newNode(String.valueOf(nID++)); + firstNode.setX(-500 + r.nextInt(1000)); + firstNode.setY(-500 + r.nextInt(1000)); + firstNode.setSize(8f); + + String nodeLabel = ""; + + for (Node n : firstClique) { + nodeLabel += n.getLabel() + ","; + } + + nodeLabel = nodeLabel.substring(0, nodeLabel.length() - 1); //remove last , + firstNode.setLabel(nodeLabel); + + nodes.add(firstNode); + } + + report += "[+]
Detecting and creating the edges ..."; + HashSet edges = new HashSet(); + + for (Node vi : nodes) { + for (Node vj : nodes) { + if ((vi != vj) && (getSharedNodes(vi, vj) == k - 1)) { + if (g.isDirected()) { + edges.add(gm.factory().newEdge(vi, vj, true)); + } else { + edges.add(gm.factory().newEdge(vi, vj, false)); + } + } + } + } + + report += "[+]
Redrawing new graph ..."; + for (Node n : nodes) { + g.addNode(n); + } + + + for (Edge e : edges) { + g.addEdge(e); + } + + report += "[+]
Done!


Palla, Gergely, Imre Derényi, Illés Farkas, and Tamás Vicsek. \"Uncovering the overlapping community structure of complex networks in nature and society.\" Nature 435, no. 7043 (2005): 814-818"; + + } + + private int getSharedNodes(Node vi, Node vj) { + String[] firstCliqueNodes = vi.getLabel().split(","); + String[] secondCliqueNodes = vj.getLabel().split(","); + + int sharedNodes = 0; + + for (String n1 : firstCliqueNodes) { + for (String n2 : secondCliqueNodes) { + if (n1.equals(n2)) { + sharedNodes++; + } + } + } + + return sharedNodes; + } + + @Override + public String getReport() { + return report; + } + + @Override + public boolean cancel() { + cancel = true; + return true; + } + + @Override + public void setProgressTicket(ProgressTicket pt) { + this.progressTicket = pt; + } + + public int getK() { + return k; + } + + public void setK(int k) { + this.k = k; + } +} diff --git a/src/org/urmiauniversity/it/mst/cpm/CPMBuilder.java b/modules/CPMplugin/src/main/java/com/plugin/CPMBuilder.java similarity index 65% rename from src/org/urmiauniversity/it/mst/cpm/CPMBuilder.java rename to modules/CPMplugin/src/main/java/com/plugin/CPMBuilder.java index a290311..0a9a707 100644 --- a/src/org/urmiauniversity/it/mst/cpm/CPMBuilder.java +++ b/modules/CPMplugin/src/main/java/com/plugin/CPMBuilder.java @@ -1,34 +1,25 @@ -/* - * 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 org.urmiauniversity.it.mst.cpm; - -import org.gephi.statistics.spi.Statistics; -import org.gephi.statistics.spi.StatisticsBuilder; -import org.openide.util.lookup.ServiceProvider; - -/** - * - * @author Mir Saman Tajbakhsh - */ -@ServiceProvider (service = StatisticsBuilder.class) -public class CPMBuilder implements org.gephi.statistics.spi.StatisticsBuilder { - - @Override - public String getName() { - return "Clique Percolation Method"; - } - - @Override - public Statistics getStatistics() { - return new CPM(); - } - - @Override - public Class getStatisticsClass() { - return CPM.class; - } - -} +package com.plugin; + +import org.gephi.statistics.spi.Statistics; +import org.gephi.statistics.spi.StatisticsBuilder; +import org.openide.util.lookup.ServiceProvider; + +@ServiceProvider (service = StatisticsBuilder.class) +public class CPMBuilder implements org.gephi.statistics.spi.StatisticsBuilder { + + @Override + public String getName() { + return "Clique Percolation Method"; + } + + @Override + public Statistics getStatistics() { + return new CPM(); + } + + @Override + public Class getStatisticsClass() { + return CPM.class; + } + +} diff --git a/src/org/urmiauniversity/it/mst/cpm/CPMPanel.java b/modules/CPMplugin/src/main/java/com/plugin/CPMPanel.java similarity index 62% rename from src/org/urmiauniversity/it/mst/cpm/CPMPanel.java rename to modules/CPMplugin/src/main/java/com/plugin/CPMPanel.java index 7744f26..aa7d1d6 100644 --- a/src/org/urmiauniversity/it/mst/cpm/CPMPanel.java +++ b/modules/CPMplugin/src/main/java/com/plugin/CPMPanel.java @@ -1,85 +1,77 @@ -/* - * 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 org.urmiauniversity.it.mst.cpm; - -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Insets; -import javax.swing.GroupLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -/** - * - * @author Mir Saman Tajbakhsh - */ -public class CPMPanel extends JPanel { - - JTextField kvalue; - - @SuppressWarnings("unchecked") - public CPMPanel() { - //this.setLayout(null); - org.jdesktop.swingx.JXHeader jXHeader1 = new org.jdesktop.swingx.JXHeader(); - - jXHeader1.setDescription("Enter the value for k (clique size, ex: k = 3 will find triangualrs). Higher values of k may take more time for computation. This algorithm is NP-Hard, so use it carefully."); // NOI18N - jXHeader1.setTitle("Clique Detector"); - - JLabel label = new JLabel("Enter value of k here:"); - label.setFont(new Font("Times New Roman", Font.ROMAN_BASELINE, 13)); - this.add(label); - kvalue = new JTextField(); - this.add(kvalue); - Insets insets = this.getInsets(); - - Dimension size = label.getPreferredSize(); - label.setBounds(20 + insets.left, 30 + insets.top, size.width, size.height); - - Dimension size1 = kvalue.getPreferredSize(); - kvalue.setBounds(20 + insets.left, 130 + insets.top, size1.width + 20, size1.height); - - javax.swing.GroupLayout layout = new GroupLayout(this); - this.setLayout(layout); - - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jXHeader1, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(label) - .addContainerGap(354, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(kvalue) - .addContainerGap(382, Short.MAX_VALUE)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jXHeader1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(label) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(kvalue) - .addContainerGap(187, Short.MAX_VALUE)) - ); - } - - public int getK() { - int i = 0; - try { - i = Integer.valueOf(kvalue.getText()); - } catch (Exception ex) { - return 0; - } - return i; - } - - public void setK(int k) { - this.kvalue.setText(String.valueOf(k)); - } -} +package com.plugin;/* + * 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. + */ + + +import javax.swing.*; +import java.awt.*; + + +public class CPMPanel extends JPanel { + + JTextField kvalue; + + @SuppressWarnings("unchecked") + public CPMPanel() { + //this.setLayout(null); + JLabel jXHeader1 = new JLabel(); + + jXHeader1.setText("Enter the value for k (clique size, ex: k = 3 will find triangualrs). Higher values of k may take more time for computation. This algorithm is NP-Hard, so use it carefully."); // NOI18N +// jXHeader1.setTitle("Clique Detector"); + + JLabel label = new JLabel("Enter value of k here:"); + label.setFont(new Font("Times New Roman", Font.ROMAN_BASELINE, 13)); + this.add(label); + kvalue = new JTextField(); + this.add(kvalue); + Insets insets = this.getInsets(); + + Dimension size = label.getPreferredSize(); + label.setBounds(20 + insets.left, 30 + insets.top, size.width, size.height); + + Dimension size1 = kvalue.getPreferredSize(); + kvalue.setBounds(20 + insets.left, 130 + insets.top, size1.width + 20, size1.height); + + GroupLayout layout = new GroupLayout(this); + this.setLayout(layout); + + layout.setHorizontalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jXHeader1, GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(label) + .addContainerGap(354, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(kvalue) + .addContainerGap(382, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jXHeader1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(label) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(kvalue) + .addContainerGap(187, Short.MAX_VALUE)) + ); + } + + public int getK() { + int i = 0; + try { + i = Integer.parseInt(kvalue.getText()); + } catch (Exception ex) { + return 0; + } + return i; + } + + public void setK(int k) { + this.kvalue.setText(String.valueOf(k)); + } +} diff --git a/src/org/urmiauniversity/it/mst/cpm/CPMUI.java b/modules/CPMplugin/src/main/java/com/plugin/CPMUI.java similarity index 89% rename from src/org/urmiauniversity/it/mst/cpm/CPMUI.java rename to modules/CPMplugin/src/main/java/com/plugin/CPMUI.java index 7f0f057..15e9009 100644 --- a/src/org/urmiauniversity/it/mst/cpm/CPMUI.java +++ b/modules/CPMplugin/src/main/java/com/plugin/CPMUI.java @@ -1,75 +1,71 @@ -/* - * 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 org.urmiauniversity.it.mst.cpm; - -import javax.swing.JPanel; -import org.gephi.statistics.spi.Statistics; -import org.gephi.statistics.spi.StatisticsUI; -import org.openide.util.lookup.ServiceProvider; - -/** - * - * @author Mir Saman Tajbakhsh - */ -@ServiceProvider(service = StatisticsUI.class) -public class CPMUI implements StatisticsUI { - - private CPMPanel panel; - private CPM myCliqueDetector; - - @Override - public JPanel getSettingsPanel() { - panel = new CPMPanel(); - return panel; - } - - @Override - public void setup(Statistics ststcs) { - this.myCliqueDetector = (CPM) ststcs; - if (panel != null) { - panel.setK(myCliqueDetector.getK()); - } - } - - @Override - public void unsetup() { - if (panel != null) { - myCliqueDetector.setK(panel.getK()); - } - panel = null; - } - - @Override - public Class getStatisticsClass() { - return CPM.class; - } - - @Override - public String getValue() { - return null; - } - - @Override - public String getDisplayName() { - return "Clique Percolation Method"; - } - - @Override - public String getShortDescription() { - return "Clique Percolation Method implementaion in gephi"; - } - - @Override - public String getCategory() { - return CATEGORY_NETWORK_OVERVIEW; - } - - @Override - public int getPosition() { - return 800; - } - -} +package com.plugin;/* + * 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. + */ + +import org.gephi.statistics.spi.Statistics; +import org.gephi.statistics.spi.StatisticsUI; +import org.openide.util.lookup.ServiceProvider; + +import javax.swing.*; + +@ServiceProvider(service = StatisticsUI.class) +public class CPMUI implements StatisticsUI { + + private CPMPanel panel; + private CPM myCliqueDetector; + + @Override + public JPanel getSettingsPanel() { + panel = new CPMPanel(); + return panel; + } + + @Override + public void setup(Statistics ststcs) { + this.myCliqueDetector = (CPM) ststcs; + if (panel != null) { + panel.setK(myCliqueDetector.getK()); + } + } + + @Override + public void unsetup() { + if (panel != null) { + myCliqueDetector.setK(panel.getK()); + } + panel = null; + } + + @Override + public Class getStatisticsClass() { + return CPM.class; + } + + @Override + public String getValue() { + return null; + } + + @Override + public String getDisplayName() { + return "Clique Percolation Method"; + } + + @Override + public String getShortDescription() { + return "Clique Percolation Method implementaion in gephi"; + } + + @Override + public String getCategory() { + return CATEGORY_NETWORK_OVERVIEW; + } + + @Override + public int getPosition() { + return 800; + } + +} diff --git a/modules/CPMplugin/src/main/nbm/manifest.mf b/modules/CPMplugin/src/main/nbm/manifest.mf new file mode 100644 index 0000000..93ac04c --- /dev/null +++ b/modules/CPMplugin/src/main/nbm/manifest.mf @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Name: CPM plugin +OpenIDE-Module-Short-Description: Clique Percolation Method implementation +OpenIDE-Module-Long-Description: Simple algorithm for detecting overlapping communities based on node centeric method. +OpenIDE-Module-Display-Category: Tool diff --git a/nbactions.xml b/nbactions.xml new file mode 100644 index 0000000..b7b2caf --- /dev/null +++ b/nbactions.xml @@ -0,0 +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} + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml deleted file mode 100644 index 306dde5..0000000 --- a/nbproject/build-impl.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties deleted file mode 100644 index ec7c8b3..0000000 --- a/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=db4822ab -build.xml.script.CRC32=3a0c724f -build.xml.stylesheet.CRC32=a56c6a5b@2.67.1 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=db4822ab -nbproject/build-impl.xml.script.CRC32=f45ef665 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1 diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index eb5b47b..0000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,5 +0,0 @@ -javac.source=1.6 -javac.compilerargs=-Xlint -Xlint:-serial -nbm.homepage=http://cse.urmia.ac.ir/~mst -nbm.module.author=Mir Saman Tajbakhsh -nbm.needs.restart=true diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index fce6945..0000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - org.urmiauniversity.it.mst.cpm - - - - org.gephi.data.attributes.api - - - - 0.8.2 - - - - org.gephi.graph.api - - - - 0.8.2 - - - - org.gephi.io.exporter.api - - - - 0.8.2 - - - - org.gephi.project.api - - - - 0.8.2 - - - - org.gephi.statistics.api - - - - 0.8.2 - - - - org.gephi.ui.library.wrapper - - - - 0.8.2 - - - - org.gephi.utils.longtask - - - - 0.8.2 - - - - org.netbeans.modules.settings - - - - 1 - 1.35.1 - - - - org.openide.awt - - - - 7.46.1 - - - - org.openide.util - - - - 8.25.2 - - - - org.openide.util.lookup - - - - 8.15.2 - - - - org.openide.windows - - - - 6.55.2 - - - - - - - diff --git a/nbproject/suite.properties b/nbproject/suite.properties deleted file mode 100644 index 364e160..0000000 --- a/nbproject/suite.properties +++ /dev/null @@ -1 +0,0 @@ -suite.dir=${basedir}/.. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0e5165d --- /dev/null +++ b/pom.xml @@ -0,0 +1,223 @@ + + + 4.0.0 + + org.gephi + gephi-plugins + 0.10.0 + pom + + gephi-plugins + + + + + modules/CPMplugin + + + + + + 0.10.0 + ${project.build.directory}/plugins_clusters + github + + + + + scm:git:git://github.com/gephi/gephi-plugins.git + scm:git:git@github.com:gephi/gephi-plugins.git + https://github.com/gephi/gephi-plugins + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + + + github + scm:git:https://github.com/gephi/gephi-plugins.git + + + + + + + ${project.groupId} + gephi + ${gephi.version} + linux-x64 + tar.gz + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.2.0 + + + org.apache.netbeans.utilities + nbm-maven-plugin + 4.5 + true + + + org.gephi + gephi-maven-plugin + 1.3.4 + + + org.apache.maven.plugins + maven-scm-publish-plugin + 3.1.0 + + + + + + + + + org.gephi + gephi-maven-plugin + + https://gephi.org/gephi-plugins/plugins/ + ${project.build.directory}/gephi-${gephi.version} + ${project.build.directory}/site/plugins/ + true + + ${clusters.path}/plugins + + + + + validate-plugin + + validate + + validate + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + prepare-package + + unpack-dependencies + + + ${project.groupId} + gephi + + ${project.build.directory} + + **/jre/** + **/jre-x64/** + + + + + + + + org.apache.netbeans.utilities + nbm-maven-plugin + + ${clusters.path} + + + + package + + cluster + + + + + default-branding + none + + + + + + + + + + release + + + + + org.gephi + gephi-maven-plugin + + + build-metadata + + build-metadata + + package + + + create-autoupdate + + create-autoupdate + + package + + + + + + + org.apache.maven.plugins + maven-scm-publish-plugin + + ${project.build.directory}/site + gh-pages + Autoupdate update for ${project.version} and gephiVersion=${gephi.version} + github + true + + + + + + + +