I would like to ask is there any way to connect all nodes using one and simple method from Jung2 API. I would like to get full graph for the nodes that I did place on my canvas.

有帮助吗?

解决方案

Generating a complete graph for a given set of nodes is pretty trivial (and also fairly uncommon), so JUNG doesn't provide a method to do this. The code would look something like this:

for (V v : g.getVertices()) {
  for (V w: g.getVertices()) {
    g.addEdge(createEdge(), v, w);
  }
}

(You'd need to supply an implementation of createEdge().)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top