0

我使用 jgrapht。我将生成子图。

我认为jgrapht-0.8.2/jgrapht-0.8.2/src/org/jgrapht/graph/DirectedSubgraph.java对这个目的很有用。但我找不到如何使用这个类?你能帮助我吗 ?

例如:jgrapht-0.8.2/jgrapht-0.8.2/src/org/jgrapht/demo/HelloJGraphT.java 有向图构造函数的使用与 HelloJGraphT.java 类中的一样

DirectedGraph<String, DefaultEdge> g =
            new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class);
4

1 回答 1

0

if you want to create your new sub graph, you have to write this code:

DirectedSubgraph<String, DefaultEdge> YouSubGraph = new DirectedSubgraph<String, DefaultEdge>(arg0, arg1, arg2)

Where arg0, is your main graph, arg1 is the set of your vertex in your sub graph, and arg2 is the set of your edges in your sub graph.

You can obtain the edged set using:

Set<DefaultEdge> YourEdges = YouSubGraph.edgeSet();

I think that you could obtain the vertex on the same way.

Sorry for mi English I hope it helps you.

于 2012-06-13T08:51:39.607 回答