Skip to content

Basic conversion tool to visualize Graph4Scala graphs with the Gephi toolkit

License

Notifications You must be signed in to change notification settings

mcallisto/scala-graph-to-gephi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central Codacy Badge Codacy Badge Codecov badge

Graph4Scala graphs to Gephi images

Basic conversion tool to visualize Graph4Scala graphs with the Gephi toolkit.

Bridging two worlds

Graphs are seamless Scala collections thanks to the excellent Graph for Scala library by Peter Empen.

Sometimes is needed to quickly visualize them, for example for test purposes.

Gephi is an award-winning open-source platform for visualizing and manipulating large graphs, with a standalone toolkit.

How to

Use

Note that one resolver must be added and dependencies overridden to access the Gephi Toolkit sources.

From a Mill project

import mill._, scalalib._
import coursier.maven.MavenRepository

object foo extends ScalaModule {
  def repositories = super.repositories ++ Seq(
    MavenRepository("https://raw.github.com/gephi/gephi/mvn-thirdparty-repo/")
  )

  def ivyDeps = Agg(
    ivy"vision.id::graphgephi:0.1.3",
    ivy"org.netbeans.modules:org-netbeans-core:RELEASE90",
    ivy"org.netbeans.modules:org-netbeans-core-startup-base:RELEASE90",
    ivy"org.netbeans.modules:org-netbeans-modules-masterfs:RELEASE90",
    ivy"org.netbeans.api:org-openide-util-lookup:RELEASE90"
  )
}

From an sbt project

resolvers ++= Seq(
  "gephi-thirdparty" at "https://raw.github.com/gephi/gephi/mvn-thirdparty-repo/"
)

libraryDependencies ++= Seq(
  "org.gephi" % "gephi-toolkit" % "0.9.2" classifier "all",
  "vision.id" %% "graphgephi" % "0.1.3"
)

dependencyOverrides ++= Seq(
  "org.netbeans.modules" % "org-netbeans-core"              % "RELEASE90",
  "org.netbeans.modules" % "org-netbeans-core-startup-base" % "RELEASE90",
  "org.netbeans.modules" % "org-netbeans-modules-masterfs"  % "RELEASE90",
  "org.netbeans.api"     % "org-openide-util-lookup"        % "RELEASE90"
)

Draw a graph

Add the Drawable trait to your project and use the makeImage(g: Graph[N, E], path: String, name: String) method to draw a PNG raster image file or an SVG vectorial image file.

directed graph image Graph(1 ~> 2, 2 ~> 3, 3 ~> 4, 4 ~> 5, 5 ~> 1, 1 ~ 4, 6 ~> 4)

Test

The library can be built with

Mill

  1. Install Mill
  2. Open a terminal and cd to the repo directory
  3. Use the mill jvm.test command to run all tests
  4. Or use the mill jvm.test.one [testClassName] command to run a single test class

sbt

  1. Open a terminal and cd to the repo directory
  2. Use the sbt command to launch sbt
  3. Use the test command to run all tests
  4. Or use the testOnly vision.id.graphgephi.[testClassName] command to run a single test class

About

Basic conversion tool to visualize Graph4Scala graphs with the Gephi toolkit

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages