fix: newlines in toDot

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-15 22:46:55 +02:00
parent dafe85c6d3
commit 7a896e0fa7
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -21,7 +21,7 @@ class RankedTree {
let highlight =
node === highlightedNode ? ', color="blue", penwidth=3' : "";
result.push(
`\t"Node(${value})" [label="${value}, ${rank}"${highlight}];`
`\t"Node(${value})" [label="${value}, ${rank}"${highlight}];\n`
);
[node.left, node.right]
@ -39,7 +39,7 @@ class RankedTree {
result.push(
`\t"Node(${u.value})" -> "Node(${
v.value
})" [label="${nodeDifference(v)}"]`
})" [label="${nodeDifference(v)}"];\n`
);
});
@ -47,7 +47,11 @@ class RankedTree {
}
toDot(highlightedNode) {
return ["digraph {", ...this._getUnwrappedGraph(highlightedNode), "}"];
return [
"digraph {\n",
...this._getUnwrappedGraph(highlightedNode),
"}\n",
];
}
toString() {