本文整理汇总了Java中edu.uci.ics.jung.graph.DirectedSparseMultigraph.containsVertex方法的典型用法代码示例。如果您正苦于以下问题:Java DirectedSparseMultigraph.containsVertex方法的具体用法?Java DirectedSparseMultigraph.containsVertex怎么用?Java DirectedSparseMultigraph.containsVertex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.graph.DirectedSparseMultigraph
的用法示例。
在下文中一共展示了DirectedSparseMultigraph.containsVertex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GraphPanel
import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public GraphPanel(DirectedSparseMultigraph<V, E> graph) {
// this.setLayout(new FlowLayout());
DirectedSparseMultigraph<V, E> graphTemp = new DirectedSparseMultigraph<V, E>();
for (V vertex : graph.getVertices()) {
if (graph.inDegree(vertex) > 0 || graph.outDegree(vertex) > 0) {
graphTemp.addVertex(vertex);
}
}
for (E edge : graph.getEdges()) {
if (graphTemp.containsVertex(graph.getSource(edge))
&& graphTemp.containsVertex(graph.getDest(edge))) {
graphTemp.addEdge(edge, graph.getSource(edge), graph.getDest(edge));
}
}
this.graph = graphTemp;
layout = new KKLayout<V, E>(this.graph);
layout.setSize(new Dimension(1000, 800)); // sets the initial size of the
// space
// The BasicVisualizationServer<V,E> is parameterized by the edge types
BasicVisualizationServer<V, E> server = new BasicVisualizationServer<V, E>(
layout);
server.setPreferredSize(new Dimension(1000, 800));
this.add(server);
}
示例2: inDegreeOnSubgraph
import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public static <V,E,T extends Comparable<T>> int[] inDegreeOnSubgraph(KepProblemDataInterface<V,E> multiPeriodCyclePacking,
Set<V> vertices, DirectedSparseMultigraph<V,E> subgraph){
int[] ans = new int[vertices.size()];
int i = 0;
for(V vertex: vertices){
if(!subgraph.containsVertex(vertex)){
throw new RuntimeException();
}
ans[i++] = subgraph.inDegree(vertex);
}
return ans;
}
示例3: inDegreeOnSubgraphToMap
import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public static <V,E,T extends Comparable<T>> Map<V,Integer> inDegreeOnSubgraphToMap(
KepProblemDataInterface<V,E> multiPeriodCyclePacking,
Set<V> vertices, DirectedSparseMultigraph<V,E> subgraph){
Map<V,Integer> ans = new HashMap<V,Integer>();
for(V vertex: vertices){
if(!subgraph.containsVertex(vertex)){
throw new RuntimeException();
}
ans.put(vertex,subgraph.inDegree(vertex));
}
return ans;
}
示例4: outDegreeOnSubgraph
import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public static <V,E,T extends Comparable<T>> int[] outDegreeOnSubgraph(KepProblemDataInterface<V,E> multiPeriodCyclePacking,
Set<V> vertices, DirectedSparseMultigraph<V,E> subgraph){
int[] ans = new int[vertices.size()];
int i = 0;
for(V vertex: vertices){
if(!subgraph.containsVertex(vertex)){
throw new RuntimeException();
}
ans[i++] = subgraph.outDegree(vertex);
}
return ans;
}
示例5: outDegreeOnSubgraphToMap
import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public static <V,E,T extends Comparable<T>> Map<V,Integer> outDegreeOnSubgraphToMap(
KepProblemDataInterface<V,E> multiPeriodCyclePacking,
Set<V> vertices, DirectedSparseMultigraph<V,E> subgraph){
Map<V,Integer> ans = new HashMap<V,Integer>();
for(V vertex: vertices){
if(!subgraph.containsVertex(vertex)){
throw new RuntimeException();
}
ans.put(vertex,subgraph.outDegree(vertex));
}
return ans;
}