开发者

graph library for scala [closed]

开发者 https://www.devze.com 2022-12-23 09:32 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

Is there a good library (or wrapper to Java library) for graphs, and/or graph algorithms in scala?

This one seems to be quite d开发者_开发问答ead. 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 ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消