英文:
Guava: Copy-Constructor for graphs
问题
我正在寻找Guava图中的拷贝构造函数。到目前为止,我尝试了以下代码:
copy = GraphBuilder.from(g).build();
"from(..)" 只会复制图的属性(有向/无向),而不会复制边/顶点。
我正在寻找一个真正包含顶点/边的拷贝。Guava是否支持这个功能?
英文:
I'm searching for a copy-constructor for graphs in guava. So far I've tried this:
copy = GraphBuilder.from(g).build();
"from(..)" only copies the properties (directed/undirected) of the graph, not the edges/vertices.
I'm searching for an actual copy with vertices/edges. Does guava support this?
答案1
得分: 2
听起来你正在寻找 Graphs.copyOf。
英文:
It sounds like you're looking for Graphs.copyOf.
专注分享java语言的经验与见解,让所有开发者获益!
评论