Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
server-id: ossrh
server-id: central
server-username: OSSRH_USER
server-password: OSSRH_PASS
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
java: ['11', '17']
java: ['17']
distribution: ['temurin']
fail-fast: false
name: ${{ matrix.os }} JDK ${{ matrix.distribution }} ${{ matrix.java }}
steps:
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Set up JDK
id: setupjdk
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
Expand Down
62 changes: 6 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Best way to start is through examples on [Toolkit Demos](https://github.com/geph
<dependency>
<groupId>org.gephi</groupId>
<artifactId>gephi-toolkit</artifactId>
<version>0.10.1</version>
<version>0.11.2</version>
</dependency>
```

#### From a Gradle project

```
compile 'org.gephi:gephi-toolkit:0.10.1'
compile 'org.gephi:gephi-toolkit:0.11.2'
```

#### From a Scala SBT Project
Expand All @@ -39,57 +39,7 @@ resolvers ++= Seq(
"gephi-thirdparty" at "https://raw.github.com/gephi/gephi/mvn-thirdparty-repo/"
)

libraryDependencies += "org.gephi" % "gephi-toolkit" % "0.10.1" classifier "all"
```

## Latest releases

### Stable

- Latest stable release on [gephi.org](http://gephi.org/toolkit).

### Development Build

- [gephi-toolkit-0.10.2-SNAPSHOT-all.jar](https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi-toolkit&v=0.10-2-SNAPSHOT&c=all)

### Development Build (Maven)

If you use Maven you can directly depend on the latest development version of the toolkit (i.e the -SNAPSHOT version).

- Add the Gephi repository

```xml
<project>
...
<repositories>
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
...
</project>
```

- Add the dependency

```xml
<project>
...
<dependencies>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>gephi-toolkit</artifactId>
<version>0.10.2-SNAPSHOT</version>
</dependency>
...
</dependencies>
...
</project>
libraryDependencies += "org.gephi" % "gephi-toolkit" % "0.11.2" classifier "all"
```

## Build
Expand All @@ -100,7 +50,7 @@ It sources its Gephi dependencies from [Maven Central](https://central.sonatype.

### Requirements

- Java JDK 11.
- Java JDK 17.

- [Apache Maven](http://maven.apache.org/) version 3.6.3 or later

Expand All @@ -116,8 +66,8 @@ It sources its Gephi dependencies from [Maven Central](https://central.sonatype.

### Can the Toolkit use plugins?

Yes that is possible if the plug-in doesn’t depend on something not included in the Toolkit, for instance the UI. If that happens, it is likely that the plug-in has been divided in several modules, and in that case one need only the core and can exclude the UI.
Consult this [HowTo](https://github.com/gephi/gephi/wiki/How-to-use-plug-ins-with-the-Toolkit) page to know how to extract the plugin JARs from the NBM file. Once you have the JARs, include them in your project’s classpath, in addition of the Gephi Toolkit.
Yes, that is possible if the plug-in doesn’t depend on something not included in the Toolkit, for instance the UI. If that happens, it is likely that the plug-in has been divided in several modules, and in that case one need only the core and can exclude the UI.
We recommend pulling JAR dependencies directly from Maven Central.

### Can it depends on a development version of Gephi?

Expand Down
66 changes: 31 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.gephi</groupId>
<artifactId>gephi-toolkit</artifactId>
<version>0.10.2-SNAPSHOT</version>
<version>0.11.2</version>
<packaging>jar</packaging>

<name>gephi-toolkit</name>
Expand Down Expand Up @@ -60,13 +60,13 @@
<netbeans.run.params>${netbeans.run.params.ide}</netbeans.run.params>

<!-- Netbeans Platform version -->
<netbeans.version>RELEASE160</netbeans.version>
<netbeans.version>RELEASE290</netbeans.version>

<!-- Gephi version -->
<gephi.version>${project.version}</gephi.version>

<!-- Java compilation settings -->
<gephi.javac.release>11</gephi.javac.release>
<gephi.javac.release>17</gephi.javac.release>
<gephi.javac.xlint>-Xlint:all</gephi.javac.xlint>
<gephi.javac.showDeprecation>true</gephi.javac.showDeprecation>
<gephi.javac.showWarnings>true</gephi.javac.showWarnings>
Expand All @@ -75,11 +75,7 @@
<!-- Testing settings -->
<gephi.test.maxMemory>768M</gephi.test.maxMemory>
<gephi.test.reportsDirectory>${project.build.directory}/surefire-reports/plain</gephi.test.reportsDirectory>

<!-- Repository URLs -->
<gephi.ossrh.repository.id>ossrh</gephi.ossrh.repository.id>
<gephi.ossrh.repository.url>https://oss.sonatype.org/content/repositories/snapshots</gephi.ossrh.repository.url>


<!-- SCM -->
<gephi.scm>git</gephi.scm>

Expand All @@ -88,23 +84,23 @@

<!--==== Plugin Versions ==================================================================================-->

<gephi.maven-assembly-plugin.version>3.3.0</gephi.maven-assembly-plugin.version>
<gephi.maven-assembly-plugin.version>3.7.1</gephi.maven-assembly-plugin.version>

<gephi.maven-compiler-plugin.version>3.10.0</gephi.maven-compiler-plugin.version>
<gephi.maven-compiler-plugin.version>3.13.0</gephi.maven-compiler-plugin.version>

<gephi.maven-gpg-plugin.version>3.0.1</gephi.maven-gpg-plugin.version>

<gephi.maven-javadoc-plugin.version>3.4.1</gephi.maven-javadoc-plugin.version>
<gephi.maven-javadoc-plugin.version>3.7.0</gephi.maven-javadoc-plugin.version>

<gephi.maven-surefire-plugin.version>2.22.2</gephi.maven-surefire-plugin.version>
<gephi.maven-surefire-plugin.version>3.2.5</gephi.maven-surefire-plugin.version>

<gephi.maven-site-plugin.version>3.11.0</gephi.maven-site-plugin.version>

<gephi.nexus-staging-maven-plugin.version>1.6.12</gephi.nexus-staging-maven-plugin.version>
<gephi.maven-site-plugin.version>3.12.1</gephi.maven-site-plugin.version>

<gephi.license-maven-plugin.version>4.1</gephi.license-maven-plugin.version>

<gephi.maven-enforcer-plugin.version>3.2.1</gephi.maven-enforcer-plugin.version>
<gephi.maven-enforcer-plugin.version>3.5.0</gephi.maven-enforcer-plugin.version>

<gephi.central-publishing-maven-plugin.version>0.10.0</gephi.central-publishing-maven-plugin.version>
</properties>

<!-- Repositories -->
Expand All @@ -117,22 +113,17 @@
</snapshots>
</repository>
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<!-- Locations of the artifacts published -->
<distributionManagement>
<snapshotRepository>
<id>${gephi.ossrh.repository.id}</id>
<url>${gephi.ossrh.repository.url}</url>
</snapshotRepository>
</distributionManagement>

<!-- Dependencies -->
<dependencies>
Expand Down Expand Up @@ -362,6 +353,12 @@
<artifactId>maven-enforcer-plugin</artifactId>
<version>${gephi.maven-enforcer-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${gephi.central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -416,7 +413,7 @@
<detectOfflineLinks>true</detectOfflineLinks>
<quiet>false</quiet>
<doclint>none</doclint>
<source>11</source>
<source>17</source>
<doctitle>Gephi Toolkit ${project.version} API Index</doctitle>
</configuration>
<executions>
Expand Down Expand Up @@ -453,16 +450,15 @@
</execution>
</executions>
</plugin>
<!-- Nexus staging, https://oss.sonatype.org/ -->

<!-- Maven central -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>

Expand Down
38 changes: 38 additions & 0 deletions src/test/java/org/gephi/toolkit/FilteringTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
*/
package org.gephi.toolkit;

import java.io.IOException;
import java.io.StringWriter;
import org.gephi.appearance.api.AppearanceModel;
import org.gephi.filters.api.Query;
import org.gephi.filters.api.Range;
Expand All @@ -47,6 +49,9 @@
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphView;
import org.gephi.graph.api.Node;
import org.gephi.io.exporter.plugin.ExporterGraphML;
import org.gephi.io.exporter.spi.CharacterExporter;
import org.gephi.io.exporter.spi.Exporter;
import org.gephi.project.api.Project;
import org.gephi.project.api.Workspace;
import org.junit.Assert;
Expand Down Expand Up @@ -111,6 +116,39 @@ public void testPartitionFilter() {
Assert.assertTrue(filteredGraph.contains(graph.getNode(GraphGenerator.SECOND_NODE)));
}

@Test
public void testExportToLabelVisible() {
// Reproduces gephi/gephi-toolkit-demos#5: filterController.exportToLabelVisible(query)
// should set label visibility to true for nodes matching the query and false for the rest.
Project project = projectController.newProject();
Workspace workspace = project.getCurrentWorkspace();

Graph graph = GraphGenerator.build(workspace).generateTinyGraph().getGraph();

// Add one extra isolated node — degree filter will exclude it
Node isolated = graph.getModel().factory().newNode("isolated");
graph.addNode(isolated);

// Ensure all labels start visible
for (Node n : graph.getNodes()) {
n.getTextProperties().setVisible(true);
}

DegreeRangeBuilder.DegreeRangeFilter degreeFilter = new DegreeRangeBuilder.DegreeRangeFilter();
degreeFilter.init(graph);
degreeFilter.setRange(new Range(1, Integer.MAX_VALUE));
Query query = filterController.createQuery(degreeFilter);

filterController.exportToLabelVisible(query);

Assert.assertFalse("Isolated node's label should be hidden after exportToLabelVisible",
isolated.getTextProperties().isVisible());
Assert.assertTrue("Connected node's label should remain visible",
graph.getNode(GraphGenerator.FIRST_NODE).getTextProperties().isVisible());
Assert.assertTrue("Connected node's label should remain visible",
graph.getNode(GraphGenerator.SECOND_NODE).getTextProperties().isVisible());
}

@Test
public void testAndOperator() {
Project project = projectController.newProject();
Expand Down
12 changes: 5 additions & 7 deletions src/test/java/org/gephi/toolkit/GeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
package org.gephi.toolkit;

import org.gephi.graph.api.GraphModel;
import org.gephi.io.generator.plugin.DynamicGraph;
import org.gephi.io.generator.plugin.RandomGraph;
import org.gephi.io.importer.api.Container;
Expand All @@ -50,8 +51,6 @@ public class GeneratorTest extends ToolkitTest {

@Test
public void testGenerate() {
Workspace workspace = Utils.newWorkspace();

//Generate a new random graph into a container
Container container = Lookup.getDefault().lookup(Container.Factory.class).newContainer();
RandomGraph randomGraph = new RandomGraph();
Expand All @@ -60,23 +59,22 @@ public void testGenerate() {
randomGraph.generate(container.getLoader());

//Append container to graph structure
importController.process(container, new DefaultProcessor(), workspace);
Workspace workspace = importController.process(container);

Assert.assertEquals(randomGraph.getNumberOfNodes(),
graphController.getGraphModel(workspace).getGraph().getNodeCount());
}

@Test
public void testGenerateDynamicGraph() {
Workspace workspace = Utils.newWorkspace();

//Generate dynamic graph into workspace
Container container = Lookup.getDefault().lookup(Container.Factory.class).newContainer();

DynamicGraph dynamicGraph = new DynamicGraph();
dynamicGraph.generate(container.getLoader());
importController.process(container, new DefaultProcessor(), workspace);
Workspace workspace = importController.process(container);

Assert.assertTrue(graphController.getGraphModel(workspace).isDynamic());
GraphModel graphModel = graphController.getGraphModel(workspace);
Assert.assertTrue(graphModel.isDynamic());
}
}
Loading
Loading