Is there a good library (or wrapper to Java library) for graphs, and/or graph algorithms in scala?
This one seems to be quite dead. This is an example for the Dijkstra algorithm in scala, but I'm looking for a library a-la JGraphT.
There is a current call-for-comments to create a scala.collection.Graph built-in into the Scala library.
Also, how about developing a Scala wrapper for JGraphT?
UPDATE
Graph for Scala is now beyond the discussion stage, and a work-in-progress.
We have developed a small graph library for the apparat project. You can take a look at it here. It is not purely functional and not a zipper graph but does a good job for us. You get also mutable and immutable graphs.
Here is a simple example for graph creation:
implicit val factory = DefaultEdge[String](_, _)
val G = Graph(
"Entry" -> "A",
"A" -> "B",
"B" -> "C",
"B" -> "D",
"D" -> "F",
"F" -> "E",
"E" -> "F",
"E" -> "C",
"C" -> "A",
"C" -> "Exit")
G.dotExport to Console.out
Finding SCCs and subcomponents
G.sccs foreach println
G.sccs map { _.entry } foreach println
G.sccs filter { _.canSearch } map { _.subcomponents } foreach { _ foreach println }
Traversal
for(x <- G.topsort) println(x)
for(x <- G.dft(y)) println(x)
The current drawback is that the library is supporting only invariant types and not feature complete for a whole graph library.
Why not Jung ? and also Piccolo2D for graphics? (both JVM based).
Gremlin-Scala is a thin thin Scala wrapper for Gremlin, a graph DSL for traversing a number of graph databases including Neo4j, OrientDB, DEX, InfiniteGraph, Titan, Rexster graph server, and Sesame 2.0 compliant RDF stores.
https://github.com/mpollmeier/gremlin-scala
Note: I am biased as I'm the author ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With