本文整理匯總了Java中org.jgrapht.DirectedGraph.containsEdge方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectedGraph.containsEdge方法的具體用法?Java DirectedGraph.containsEdge怎麽用?Java DirectedGraph.containsEdge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jgrapht.DirectedGraph
的用法示例。
在下文中一共展示了DirectedGraph.containsEdge方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createArcs
import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
protected static void createArcs(final DirectedGraph<Block, BlockConflict> blockConflictGraph,
final PathBlockSet resultBlocks, final Block x) {
for (final Either<Rule, ExistentialProxy> rule : x.getRulesOrProxies()) {
for (final Block y : resultBlocks.getRuleInstanceToBlocks().get(rule)) {
if (x == y || blockConflictGraph.containsEdge(x, y)) {
continue;
}
addArc(blockConflictGraph, x, y);
addArc(blockConflictGraph, y, x);
}
}
}
示例2: existsPath
import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private boolean existsPath(DirectedGraph<ExtendedEGD, DefaultEdge> dependencyGraph, EGDStratum t1, EGDStratum t2) {
for (ExtendedEGD dependency1 : t1.getExtendedDependencies()) {
for (ExtendedEGD dependency2 : t2.getExtendedDependencies()) {
if (dependencyGraph.containsEdge(dependency1, dependency2)) {
return true;
}
}
}
return false;
}
示例3: existsPath
import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private boolean existsPath(DirectedGraph<Dependency, DefaultEdge> dependencyGraph, TGDStratum t1, TGDStratum t2) {
for (Dependency dependency1 : t1.getTgds()) {
for (Dependency dependency2 : t2.getTgds()) {
if (dependencyGraph.containsEdge(dependency1, dependency2)) {
return true;
}
}
}
return false;
}
示例4: testGraph
import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
/**
* Compares the given graph with the expected graph. Returns true only if both<br>
* graphs are identical.
* @param graph
*/
private void testGraph(DirectedGraph<Integer,DefaultEdge> graph){
//make sure all vertices are there
for(int i=1;i<16;i++){
if(!graph.containsVertex(i)) {
fail("Graph does not contain vertex " + i);
}
}
if(!graph.containsVertex(30)) {
fail("Graph does not contain vertex " + 200);
}
if(!graph.containsVertex(200)) {
fail("Graph does not contain vertex " + 200);
}
//make sure there are no supplemental vertices
assertEquals(17, graph.vertexSet().size());
//make sure all edges are there
if(!graph.containsEdge(1,200)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(1,2)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(1,4)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(1,3)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(1,5)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(3,6)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(4,9)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(5,8)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(6,9)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(6,8)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(6,7)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(7,11)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(7,10)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(8,15)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(8,13)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(8,14)) {
fail("Graph does not contain edge");
}
if(!graph.containsEdge(8,12)) {
fail("Graph does not contain edge");
}
//make sure there no supplemental edges
assertEquals(17, graph.edgeSet().size());
}