I have to graphs which I want to unite, that is, create a new graph composed by the union of both graph's edges and nodes (without repetition). Is there an implementation for that avaliable in JUNG or do I have do so on my own?
相关问题
- How to determine +/- sign when calculating diagona
- Seaborn HeatMap - How to set colour grading throug
- error: expression is not assignable ternary operat
- Direction of tick marks in matplotlib
- Union of two object bags in Java
相关文章
- Mercurial Commit Charts / Graphs [closed]
- How to do a UNION on a single table?
- Are PostgreSQL VIEWS created newly each time they
- mysql union vs multiple queries
- Sankey diagrams in Python
- Java: Traveling Salesman - Found polynomial algori
- Generating a Voronoi Diagram around 2D Polygons
- How to calculate the best price [duplicate]
There isn't an implementation for that in JUNG, but it's about six lines of code assuming that the graphs, vertices, and edges are of the same types:
You can skip the vertex adding if there are no isolated vertices (i.e., vertices that have no incident edges);
addEdge()
will add any incident vertices.If the graph is directed, you'll want to change the above to
g.addEdge(e, g1.getSource(e), g1.getDest(e));
Duplicates are silently ignored (if you want to know whether an add had an effect, check the return value).