Skip to content

Commit 4f63ea7

Browse files
Fixes for upstream changes
1 parent 3e32d9d commit 4f63ea7

1 file changed

Lines changed: 27 additions & 28 deletions

File tree

gap/tools/display.gi

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ function(D, node_labels, edge_labels)
855855
if Length(node_labels) <> M then
856856
msg := "Expected the 2nd argument (a list) to have length ";
857857
Append(msg, "{}, but found {}");
858-
ErrorNoReturn(StringFormatted(msg), M, Length(node_labels));
858+
ErrorNoReturn(StringFormatted(msg, M, Length(node_labels)));
859859
elif not IsString(node_labels[1]) then
860860
ErrorNoReturn("TODO");
861861
elif Length(edge_labels) <> N then
@@ -867,44 +867,44 @@ function(D, node_labels, edge_labels)
867867
fi;
868868

869869
# TODO longer list here
870-
edge_colors := ["#00ff00", "#ff00ff", "#007fff", "#ff7f00",
871-
"#7fbf7f", "#4604ac", "#de0328", "#19801d",
872-
"#d881f5", "#00ffff", "#ffff00", "#00ff7f",
873-
"#ad5867", "#85f610", "#84e9f5", "#f5c778",
874-
"#207090", "#764ef3", "#7b4c00", "#0000ff",
875-
"#b80c9a", "#601045", "#29b7c0", "#839f12"];
870+
edge_colors := ["\"#00ff00\"", "\"#ff00ff\"", "\"#007fff\"", "\"#ff7f00\"",
871+
"\"#7fbf7f\"", "\"#4604ac\"", "\"#de0328\"", "\"#19801d\"",
872+
"\"#d881f5\"", "\"#00ffff\"", "\"#ffff00\"", "\"#00ff7f\"",
873+
"\"#ad5867\"", "\"#85f610\"", "\"#84e9f5\"", "\"#f5c778\"",
874+
"\"#207090\"", "\"#764ef3\"", "\"#7b4c00\"", "\"#0000ff\"",
875+
"\"#b80c9a\"", "\"#601045\"", "\"#29b7c0\"", "\"#839f12"];
876876

877877
if N > Length(edge_colors) then
878878
msg := Concatenation("the out-degree of every vertex in the 1st argument ",
879879
"(a digraph) must be at most {}, found {}");
880880
ErrorNoReturn(StringFormatted(msg, Length(edge_colors), N));
881881
fi;
882882

883-
dot := GV_Digraph("WordGraph");
884-
GV_SetAttr(dot, "node [shape=\"box\"]");
883+
dot := GraphvizDigraph("WordGraph");
884+
GraphvizSetAttr(dot, "node [shape=\"box\"]");
885885
for m in [1 .. M] do
886-
mm := GV_AddNode(dot, m);
887-
GV_SetAttr(mm, "label", node_labels[m]);
886+
mm := GraphvizAddNode(dot, m);
887+
GraphvizSetAttr(mm, "label", node_labels[m]);
888888
pos := Position(edge_labels, node_labels[m]);
889889
if pos <> fail then
890-
GV_SetAttr(mm, "color", edge_colors[pos]);
891-
GV_SetAttr(mm, "style", "filled");
890+
GraphvizSetAttr(mm, "color", edge_colors[pos]);
891+
GraphvizSetAttr(mm, "style", "filled");
892892
fi;
893893
od;
894894

895895
for m in [1 .. M] do
896896
targets := OutNeighboursOfVertex(D, m);
897897
for n in [1 .. N] do
898-
e := GV_AddEdge(dot, m, targets[n]);
899-
GV_SetAttr(e, "color", edge_colors[n]);
898+
e := GraphvizAddEdge(dot, m, targets[n]);
899+
GraphvizSetAttr(e, "color", edge_colors[n]);
900900
od;
901901
od;
902902

903-
legend := GV_AddContext(dot, "legend");
904-
GV_SetAttr(legend, "node [shape=plaintext]");
905-
subgraph := GV_AddSubgraph(legend, "legend");
906-
key := GV_AddNode(subgraph, "key");
907-
key2 := GV_AddNode(subgraph, "key2");
903+
legend := GraphvizAddContext(dot, "legend");
904+
GraphvizSetAttr(legend, "node [shape=plaintext]");
905+
subgraph := GraphvizAddSubgraph(legend, "legend");
906+
key := GraphvizAddNode(subgraph, "key");
907+
key2 := GraphvizAddNode(subgraph, "key2");
908908

909909
label := Concatenation("<<table border=\"0\" cellpadding=\"2\"",
910910
" cellspacing=\"0\"",
@@ -915,7 +915,7 @@ function(D, node_labels, edge_labels)
915915
i));
916916
od;
917917
Append(label, "</table>>\n");
918-
GV_SetAttr(key2, "label", label);
918+
GraphvizSetAttr(key2, "label", label);
919919

920920
# TODO remove code dupl
921921
label := Concatenation("<<table border=\"0\" cellpadding=\"2\"",
@@ -930,18 +930,17 @@ function(D, node_labels, edge_labels)
930930
od;
931931
Append(label, "</table>>\n");
932932

933-
GV_SetAttr(key, "label", label);
933+
GraphvizSetAttr(key, "label", label);
934934

935935
for i in [1 .. N] do
936-
e := GV_AddEdge(subgraph,
936+
e := GraphvizAddEdge(subgraph,
937937
StringFormatted("key:i{}:e", i),
938938
StringFormatted("key2:i{}:w", i));
939-
GV_SetAttr(e, "color", edge_colors[i]);
940-
GV_SetAttr(e, "constraint", false);
939+
GraphvizSetAttr(e, "color", edge_colors[i]);
940+
GraphvizSetAttr(e, "constraint", false);
941941
od;
942942

943-
str := GV_String(dot);
944-
# TODO remove the next two lines, these work around some issues in graphviz
945-
str := ReplacedString(str, "--", "->");
943+
str := AsString(dot);
944+
# TODO remove the next line, these work around some issues in graphviz
946945
return Concatenation("//dot\n", str);
947946
end);

0 commit comments

Comments
 (0)