相关疑难解决方法(0)

树(有向无环图)实现

我需要一个树/有向无环图实现,如下所示:

public class TreeNode<K, V> {
    private K key; // 'key' for this node, always present
    private V value; // 'value' for this node, doesn't have to be set

    private TreeNode<K, V> parent;
    private Set<TreeNode<K, V>> children; 
}
Run Code Online (Sandbox Code Playgroud)
  • 没有任何类型的分类.
  • TreeNode仅仅是围绕重点和可能的值的包装(节点不必有设定值).
  • 我需要父母和子女的链接.

标准API或Commons等中有什么东西可以帮我吗?

我不介意自己写(我当然不是要求大家)我只是不想重新发明轮子.

java tree graph-theory data-structures

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

data-structures ×1

graph-theory ×1

java ×1

tree ×1