Question

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.

Was it helpful?

Solution

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().)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top