本文整理汇总了Java中mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan类的典型用法代码示例。如果您正苦于以下问题:Java SuurballeTarjan类的具体用法?Java SuurballeTarjan怎么用?Java SuurballeTarjan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SuurballeTarjan类属于mulavito.algorithms.shortestpath.disjoint包,在下文中一共展示了SuurballeTarjan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnreachable
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testUnreachable() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("B"); // B -- not connected
g.addVertex(n3);
g.addEdge(new MyLink(1, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals(null, testMain.getDisjointPaths(n1, n3));
}
示例2: testNoDisjointSolution
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testNoDisjointSolution() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("A"); // A
g.addVertex(n1);
String n2 = new String("B"); // B
g.addVertex(n2);
g.addEdge(new MyLink(2, "A-B"), n1, n2, EdgeType.DIRECTED);
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[A-B]]", testMain.getDisjointPaths(n1, n2).toString());
}
示例3: testUnreachable
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testUnreachable() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("B"); // B -- not connected
g.addVertex(n3);
g.addEdge(new MyLink(1, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals(null, testMain.getDisjointPaths(n1, n3));
}
示例4: testNoDisjointSolution
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testNoDisjointSolution() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("A"); // A
g.addVertex(n1);
String n2 = new String("B"); // B
g.addVertex(n2);
g.addEdge(new MyLink(2, "A-B"), n1, n2, EdgeType.DIRECTED);
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[A-B]]", testMain.getDisjointPaths(n1, n2).toString());
}
示例5: constructorTest1
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void constructorTest1() {
Graph<String, MyLink> g = null;
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
new SuurballeTarjan<String, MyLink>(g, weightTrans);
}
示例6: constructorTest2
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void constructorTest2() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
Transformer<MyLink, Number> weightTrans = null;
new SuurballeTarjan<String, MyLink>(g, weightTrans);
}
示例7: testTargetRemoval
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testTargetRemoval() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("B"); // B
g.addVertex(n3);
String n4 = new String("C"); // C
g.addVertex(n4);
String n5 = new String("D"); // D
g.addVertex(n5);
g.addEdge(new MyLink(3, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
g.addEdge(new MyLink(1, "A-C"), n2, n4, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(3, "S-B"), n1, n3, EdgeType.DIRECTED); // S - B
g.addEdge(new MyLink(3, "B-C"), n3, n4, EdgeType.DIRECTED); // B - C
g.addEdge(new MyLink(3, "C-D"), n4, n5, EdgeType.DIRECTED); // C - D
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[S-A, A-C, C-D]]", testMain.getDisjointPaths(n1, n5)
.toString());
}
示例8: constructorTest1
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void constructorTest1() {
Graph<String, MyLink> g = null;
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
new SuurballeTarjan<String, MyLink>(g, weightTrans);
}
示例9: constructorTest2
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void constructorTest2() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
Transformer<MyLink, Number> weightTrans = null;
new SuurballeTarjan<String, MyLink>(g, weightTrans);
}
示例10: testTargetRemoval
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testTargetRemoval() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("B"); // B
g.addVertex(n3);
String n4 = new String("C"); // C
g.addVertex(n4);
String n5 = new String("D"); // D
g.addVertex(n5);
g.addEdge(new MyLink(3, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
g.addEdge(new MyLink(1, "A-C"), n2, n4, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(3, "S-B"), n1, n3, EdgeType.DIRECTED); // S - B
g.addEdge(new MyLink(3, "B-C"), n3, n4, EdgeType.DIRECTED); // B - C
g.addEdge(new MyLink(3, "C-D"), n4, n5, EdgeType.DIRECTED); // C - D
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[S-A, A-C, C-D]]", testMain.getDisjointPaths(n1, n5)
.toString());
}
示例11: testSuurballe1
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testSuurballe1() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("D"); // D
g.addVertex(n3);
String n4 = new String("C"); // C
g.addVertex(n4);
String n5 = new String("F"); // F
g.addVertex(n5);
String n6 = new String("B"); // B
g.addVertex(n6);
String n7 = new String("G"); // G
g.addVertex(n7);
String n8 = new String("E"); // E
g.addVertex(n8);
g.addEdge(new MyLink(3, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
g.addEdge(new MyLink(2, "S-B"), n1, n6, EdgeType.DIRECTED); // S - B
g.addEdge(new MyLink(8, "S-D"), n1, n3, EdgeType.DIRECTED); // S - D
g.addEdge(new MyLink(1, "A-C"), n2, n4, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(4, "A-D"), n2, n3, EdgeType.DIRECTED); // A - D
g.addEdge(new MyLink(1, "D-F"), n3, n5, EdgeType.DIRECTED); // D - F
g.addEdge(new MyLink(5, "C-F"), n4, n5, EdgeType.DIRECTED); // C - F
g.addEdge(new MyLink(5, "B-E"), n6, n8, EdgeType.DIRECTED); // B - E
g.addEdge(new MyLink(2, "E-G"), n8, n7, EdgeType.DIRECTED); // E - G
g.addEdge(new MyLink(7, "G-F"), n7, n5, EdgeType.DIRECTED); // G - F
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[S-A, A-C, C-F], [S-D, D-F]]", testMain
.getDisjointPaths(n1, n5).toString());
}
示例12: testTrapTopology
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testTrapTopology() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String nS = new String("S");
g.addVertex(nS);
String nA = new String("A");
g.addVertex(nA);
String nB = new String("B");
g.addVertex(nB);
String nD = new String("D");
g.addVertex(nD);
String nE = new String("E");
g.addVertex(nE);
String nF = new String("F");
g.addVertex(nF);
String nG = new String("G");
g.addVertex(nG);
String nH = new String("H");
g.addVertex(nH);
g.addEdge(new MyLink(1, "S-A"), nS, nA, EdgeType.DIRECTED);
g.addEdge(new MyLink(1, "A-B"), nA, nB, EdgeType.DIRECTED);
g.addEdge(new MyLink(1, "B-D"), nB, nD, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "S-E"), nS, nE, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "E-F"), nE, nF, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "F-B"), nF, nB, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "A-G"), nA, nG, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "G-H"), nG, nH, EdgeType.DIRECTED);
g.addEdge(new MyLink(2, "H-D"), nH, nD, EdgeType.DIRECTED);
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[S-A, A-G, G-H, H-D], [S-E, E-F, F-B, B-D]]", testMain
.getDisjointPaths(nS, nD).toString());
}
示例13: testSuurballe2
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testSuurballe2() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("A"); // A
g.addVertex(n1);
String n2 = new String("D"); // D
g.addVertex(n2);
String n3 = new String("C"); // C
g.addVertex(n3);
String n4 = new String("F"); // F
g.addVertex(n4);
String n5 = new String("B"); // B
g.addVertex(n5);
String n6 = new String("G"); // G
g.addVertex(n6);
String n7 = new String("E"); // E
g.addVertex(n7);
g.addEdge(new MyLink(2, "A-D"), n1, n2, EdgeType.DIRECTED);
g.addEdge(new MyLink(3, "A-C"), n1, n3, EdgeType.DIRECTED);
g.addEdge(new MyLink(3, "A-F"), n1, n4, EdgeType.DIRECTED);
g.addEdge(new MyLink(1, "D-E"), n2, n7, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(3, "D-C"), n2, n3, EdgeType.DIRECTED); // A - D
g.addEdge(new MyLink(1, "C-E"), n3, n7, EdgeType.DIRECTED); // D - F
g.addEdge(new MyLink(2, "C-B"), n3, n5, EdgeType.DIRECTED); // C - F
g.addEdge(new MyLink(2, "C-G"), n3, n6, EdgeType.DIRECTED); // B - E
g.addEdge(new MyLink(2, "F-G"), n4, n6, EdgeType.DIRECTED); // E - G
g.addEdge(new MyLink(1, "F-C"), n4, n3, EdgeType.DIRECTED); // G - F
g.addEdge(new MyLink(2, "E-B"), n7, n5, EdgeType.DIRECTED); // G - F
g.addEdge(new MyLink(1, "G-B"), n6, n5, EdgeType.DIRECTED); // G - F
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[A-D, D-E, E-B], [A-C, C-B]]", testMain
.getDisjointPaths(n1, n5).toString());
}
示例14: testSuurballe3
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testSuurballe3() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("A"); // A
g.addVertex(n1);
String n2 = new String("D"); // D
g.addVertex(n2);
String n3 = new String("C"); // C
g.addVertex(n3);
String n4 = new String("F"); // F
g.addVertex(n4);
String n5 = new String("B"); // B
g.addVertex(n5);
String n6 = new String("G"); // G
g.addVertex(n6);
String n7 = new String("E"); // E
g.addVertex(n7);
g.addEdge(new MyLink(2, "A-D"), n1, n2, EdgeType.DIRECTED);
g.addEdge(new MyLink(3, "A-C"), n1, n3, EdgeType.DIRECTED);
g.addEdge(new MyLink(3, "A-F"), n1, n4, EdgeType.DIRECTED);
g.addEdge(new MyLink(3, "D-E"), n2, n7, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(0, "D-C"), n2, n3, EdgeType.DIRECTED); // A - D
g.addEdge(new MyLink(1, "C-E"), n3, n7, EdgeType.DIRECTED); // D - F
g.addEdge(new MyLink(2, "C-B"), n3, n5, EdgeType.DIRECTED); // C - F
g.addEdge(new MyLink(2, "C-G"), n3, n6, EdgeType.DIRECTED); // B - E
g.addEdge(new MyLink(2, "F-G"), n4, n6, EdgeType.DIRECTED); // E - G
g.addEdge(new MyLink(1, "F-C"), n4, n3, EdgeType.DIRECTED); // G - F
g.addEdge(new MyLink(2, "E-B"), n7, n5, EdgeType.DIRECTED); // G - F
g.addEdge(new MyLink(1, "G-B"), n6, n5, EdgeType.DIRECTED); // G - F
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[A-D, D-C, C-B], [A-F, F-G, G-B]]", testMain
.getDisjointPaths(n1, n5).toString());
}
示例15: testSuurballe1
import mulavito.algorithms.shortestpath.disjoint.SuurballeTarjan; //导入依赖的package包/类
@Test
public void testSuurballe1() {
Graph<String, MyLink> g = new DirectedOrderedSparseMultigraph<String, MyLink>();
String n1 = new String("S"); // S
g.addVertex(n1);
String n2 = new String("A"); // A
g.addVertex(n2);
String n3 = new String("D"); // D
g.addVertex(n3);
String n4 = new String("C"); // C
g.addVertex(n4);
String n5 = new String("F"); // F
g.addVertex(n5);
String n6 = new String("B"); // B
g.addVertex(n6);
String n7 = new String("G"); // G
g.addVertex(n7);
String n8 = new String("E"); // E
g.addVertex(n8);
g.addEdge(new MyLink(3, "S-A"), n1, n2, EdgeType.DIRECTED); // S - A
g.addEdge(new MyLink(2, "S-B"), n1, n6, EdgeType.DIRECTED); // S - B
g.addEdge(new MyLink(8, "S-D"), n1, n3, EdgeType.DIRECTED); // S - D
g.addEdge(new MyLink(1, "A-C"), n2, n4, EdgeType.DIRECTED); // A - C
g.addEdge(new MyLink(4, "A-D"), n2, n3, EdgeType.DIRECTED); // A - D
g.addEdge(new MyLink(1, "D-F"), n3, n5, EdgeType.DIRECTED); // D - F
g.addEdge(new MyLink(5, "C-F"), n4, n5, EdgeType.DIRECTED); // C - F
g.addEdge(new MyLink(5, "B-E"), n6, n8, EdgeType.DIRECTED); // B - E
g.addEdge(new MyLink(2, "E-G"), n8, n7, EdgeType.DIRECTED); // E - G
g.addEdge(new MyLink(7, "G-F"), n7, n5, EdgeType.DIRECTED); // G - F
Transformer<MyLink, Number> weightTrans = new Transformer<MyLink, Number>() {
@Override
public Number transform(MyLink link) {
return link.getWeight();
}
};
SuurballeTarjan<String, MyLink> testMain = new SuurballeTarjan<String, MyLink>(
g, weightTrans);
assertEquals("[[S-A, A-C, C-F], [S-D, D-F]]", testMain
.getDisjointPaths(n1, n5).toString());
}