Tree (directed acyclic graph) implementation

前端 未结 4 1943
忘掉有多难
忘掉有多难 2020-12-14 22:22

I require a tree / directed acyclic graph implementation something like this:

public class TreeNode {
    private K key; // \'key\' for this node         


        
4条回答
  •  抹茶落季
    2020-12-14 22:59

    There's also http://www.jgrapht.org, which has software licensed under the LGPL. I have to warn you though, implementing your own is fraught with danger. If you plan on using recursion on your structure (which is a graph), you'll have to ensure that it's acyclic, or you'll run into infinite loop problems. Better to use third party code where they've already dealt with the issues.

提交回复
热议问题