Merge branch 'master' into doc-release-notes-7
This commit is contained in:
@ -43,7 +43,9 @@ public final class GraphUtil {
|
||||
StringBuilder sb = new StringBuilder("strict digraph {\n");
|
||||
Map<V, String> ids = new HashMap<>();
|
||||
int i = 0;
|
||||
for (V node : vertices) {
|
||||
List<V> vertexList = new ArrayList<>(vertices);
|
||||
vertexList.sort(Comparator.comparing(Object::toString)); // for reproducibility in tests
|
||||
for (V node : vertexList) {
|
||||
String id = "n" + i++;
|
||||
ids.put(node, id);
|
||||
sb.append(id)
|
||||
@ -56,7 +58,7 @@ public final class GraphUtil {
|
||||
|
||||
List<String> edges = new ArrayList<>();
|
||||
|
||||
for (V node : vertices) {
|
||||
for (V node : vertexList) {
|
||||
// edges
|
||||
String id = ids.get(node);
|
||||
for (V succ : successorFun.apply(node)) {
|
||||
|
@ -279,15 +279,15 @@ class LatticeRelationTest {
|
||||
// all {1}, {2}, and { } are query nodes, not {1,2}
|
||||
|
||||
assertEquals("strict digraph {\n"
|
||||
+ "n0 [ shape=box, color=green, label=\"[]\" ];\n"
|
||||
+ "n0 [ shape=box, color=black, label=\"[1, 2]\" ];\n"
|
||||
+ "n1 [ shape=box, color=green, label=\"[1]\" ];\n"
|
||||
+ "n2 [ shape=box, color=green, label=\"[2]\" ];\n"
|
||||
+ "n3 [ shape=box, color=black, label=\"[1, 2]\" ];\n"
|
||||
+ "n1 -> n0;\n" // {1} -> { }
|
||||
+ "n2 -> n0;\n" // {2} -> { }
|
||||
+ "n3 -> n0;\n" // {1,2} -> { }
|
||||
+ "n3 -> n1;\n" // {1,2} -> {1}
|
||||
+ "n3 -> n2;\n" // {1,2} -> {2}
|
||||
+ "n3 [ shape=box, color=green, label=\"[]\" ];\n"
|
||||
+ "n0 -> n1;\n" // {1} -> { }
|
||||
+ "n0 -> n2;\n" // {2} -> { }
|
||||
+ "n0 -> n3;\n" // {1,2} -> { }
|
||||
+ "n1 -> n3;\n" // {1,2} -> {1}
|
||||
+ "n2 -> n3;\n" // {1,2} -> {2}
|
||||
+ "}", lattice.toString());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user