diff --git a/src/SparseTransform/Convert/ColoredDotWriter.cs b/src/SparseTransform/Convert/ColoredDotWriter.cs index 34ba19695794adfd5430cf95435bf863d6a73f1f..ac71e297a88367f45d0ec7caf81ee5f6e9eb51cd 100644 --- a/src/SparseTransform/Convert/ColoredDotWriter.cs +++ b/src/SparseTransform/Convert/ColoredDotWriter.cs @@ -7,20 +7,38 @@ using DataStructures; namespace SparseTransform.Convert { + internal class ColoredDotWriter : DotWriter { private bool textcolor; + private string[] dictColor = new string[65]; public ColoredDotWriter(bool textColor) { this.textcolor = textColor; + + for (int i = 0; i <= 3; i++) + { + for (int j = 0; j <= 3; j++) + { + for (int k = 0; k <= 4; k++) + { + dictColor[i * 16 + j * 4 + k] = ("#" + (255 - i * 60).ToString("X2") + (255 - j * 60).ToString("X2") + (255 - k * 60).ToString("X2")); + } + } + } } - public override String NodeLabel(GraphNode node, String präfix) { - return "\t" + präfix + node.Index + " [shape=circle, style=filled, fillcolor=" + node.Color + "]"; + if (textcolor || node.Color > 64) + { + return "\t" + präfix + node.Index + " [shape=circle, style=filled, label=\"" + präfix + node.Index + "\\n Farbe " + node.Color + "\"]"; + } + else + { + return "\t" + präfix + node.Index + " [shape=circle, style=filled, fillcolor=\"" + dictColor[node.Color] + "\"]"; + } } - } }