好的Java图算法库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 07:40:50  来源:igfitidea点击:

Good Java graph algorithm library?

javaalgorithmgraph

提问by Nick Fortescue

Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried JGraphand found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?

有没有人对图形算法的任何 Java 库有很好的经验。我试过JGraph并发现它可以,而且 google 中有很多不同的。有没有人们在生产代码中实际成功使用或推荐的?

To clarify, I'm not looking for a library that produces graphs/charts, I'm looking for one that helps with Graph algorithms, eg minimum spanning tree, Kruskal's algorithm Nodes, Edges, etc. Ideally one with some good algorithms/data structures in a nice Java OO API.

澄清一下,我不是在寻找一个生成图形/图表的库,我正在寻找一个有助于图形算法的库,例如最小生成树、Kruskal 算法节点、边等。理想情况下,一个具有一些好的算法/数据的库一个不错的 Java OO API 中的结构。

采纳答案by Bartosz Bierkowski

If you were using JGraph, you should give a try to JGraphTwhich is designed for algorithms. One of its features is visualization using the JGraph library. It's still developed, but pretty stable. I analyzed the complexity of JGraphT algorithms some time ago. Some of them aren't the quickest, but if you're going to implement them on your own and need to display your graph, then it might be the best choice. I really liked using its API, when I quickly had to write an app that was working on graph and displaying it later.

如果您使用的是 JGraph,您应该尝试一下专为算法设计的JGraphT。它的功能之一是使用 JGraph 库进行可视化。它仍在开发中,但相当稳定。前段时间分析了JGraphT算法的复杂度。其中一些不是最快的,但如果您要自己实现它们并需要显示图形,那么它可能是最佳选择。我真的很喜欢使用它的 API,当我很快不得不编写一个处理图形并稍后显示它的应用程序时。

回答by Jacob Rigby

For visualization our group had some success with prefuse. We extended it to handle architectural floorplates and bubble diagraming, and it didn't complain too much. They have a new Flex toolkit out too called Flare that uses a very similar API.

对于可视化,我们的团队在prefuse 上取得了一些成功。我们将它扩展到处理建筑地板和气泡图,它并没有抱怨太多。他们有一个新的 Flex 工具包,也称为 Flare,它使用非常相似的 API。

UPDATE: I'd have to agree with the comment, we ended up writing a lot of custom functionality/working around prefuse limitations. I can't say that starting from scratch would have been better though as we were able to demonstrate progress from day 1 by using prefuse. On the other hand if we were doing a second implementation of the same stuff, I might skip prefuse since we'd understand the requirements a lot better.

更新:我不得不同意评论,我们最终编写了很多自定义功能/解决了前置限制。我不能说从头开始会更好,因为我们能够通过使用 prefuse 展示从第一天开始的进展。另一方面,如果我们对相同的东西进行第二次实现,我可能会跳过前缀,因为我们会更好地理解需求。

回答by Turismo

In a university project I toyed around with yFiles by yWorksand found it had pretty good API.

在一个大学项目中,我玩弄了 yWorks 的yFiles,发现它有很好的 API。

回答by Jacob Rigby

If you are actually looking for Charting libraries and not for Node/Edge Graph libraries I would suggest splurging on Big Faceless Graph library (BFG). It's way easier to use than JFreeChart, looks nicer, runs faster, has more output options, really no comparison.

如果您实际上是在寻找 Charting 库而不是 Node/Edge Graph 库,我建议您使用 Big Faceless Graph 库 ( BFG)。它比 JFreeChart 更容易使用,看起来更好,运行更快,有更多的输出选项,真的没有可比性。

回答by Kai

JUNGis a good option for visualisation, and also has a fairly good set of available graph algorithms, including several different mechanisms for random graph creation, rewiring, etc. I've also found it to be generally fairly easy to extend and adapt where necessary.

JUNG是一个很好的可视化选择,并且还有一组相当不错的可用图形算法,包括用于随机图形创建、重新布线等的几种不同机制。我还发现它通常很容易在必要时扩展和适应.

回答by Hank Gay

I don't know if I'd call it production-ready, but there's jGABL.

我不知道我是否会称它为生产就绪,但有jGABL

回答by Joe Liversedge

Check out JGraphTfor a very simple and powerful Java graph library that is pretty well done and, to allay any confusion, is different than JGraph. Some sample code:

查看JGraphT以获得一个非常简单且功能强大的 Java 图形库,它做得非常好,为了消除任何混淆,它与 JGraph 不同。一些示例代码

UndirectedGraph<String, DefaultEdge> g =
        new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);

    String v1 = "v1";
    String v2 = "v2";
    String v3 = "v3";
    String v4 = "v4";

    // add the vertices
    g.addVertex(v1);
    g.addVertex(v2);
    g.addVertex(v3);
    g.addVertex(v4);

    // add edges to create a circuit
    g.addEdge(v1, v2);
    g.addEdge(v2, v3);
    g.addEdge(v3, v4);
    g.addEdge(v4, v1);

回答by mr.sverrir

JDSL (Data Structures Library in Java) should be good enough if you're into graph algorithms - http://www.cs.brown.edu/cgc/jdsl/

如果您喜欢图形算法,JDSL(Java 中的数据结构库)应该足够好了 - http://www.cs.brown.edu/cgc/jdsl/

回答by mansu

Summary:

概括:

回答by mansu

Try Annas its an open source graph package which is easy to get to grips with

试试 Annas,它是一个易于掌握的开源图形包

http://annas.googlecode.com

http://annas.googlecode.com