Basic conversion tool to visualize Graph4Scala graphs with the Gephi toolkit.
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.
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"
)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.
![]()
Graph(1 ~> 2, 2 ~> 3, 3 ~> 4, 4 ~> 5, 5 ~> 1, 1 ~ 4, 6 ~> 4)
The library can be built with
- Install Mill
- Open a terminal and
cdto the repo directory - Use the
mill jvm.testcommand to run all tests - Or use the
mill jvm.test.one [testClassName]command to run a single test class
- Open a terminal and
cdto the repo directory - Use the
sbtcommand to launch sbt - Use the
testcommand to run all tests - Or use the
testOnly vision.id.graphgephi.[testClassName]command to run a single test class
