How to create a graph with sugraph with jgrapht

有些话、适合烂在心里 提交于 2021-01-29 17:26:02

问题


I want to create a graph with subgraphs (I think cluster is a synonymous - not sure ?). Someone could explain how to create this type of graph and how to export this composite graph. I readed this post Creating graph with clusters using jgrapht but i am not sure to understand this sentence "You could create a graph where each vertex is a graph by itself; edges between these vertices represent relations between these special vertices.". Does it mean that in this case verticles are relations between subgraphs. How to build this verticles? Thanks


回答1:


In JGraphT, vertices and edges are arbitrary objects: a Graph<V,E> consists of vertices of type V, and edges of type E. See the wiki guide https://jgrapht.org/guide/UserOverview for details.

So you could simply define a graph where V is also a graph: Graph<Graph<String,DefaultEdge>,DefaultEdge>. In this example, each vertex in the graph, is a graph by itself, consisting of String vertices and DefaultEdge edges.



来源:https://stackoverflow.com/questions/59805890/how-to-create-a-graph-with-sugraph-with-jgrapht

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!