Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions gap/dot.gi
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,15 @@ InstallMethod(GraphvizGetAttr, "for a graphviz (di)graph or context and string",
# GraphvizAddNode
#############################################################################

InstallMethod(GraphvizAddNode, "for a graphviz (di)graph or context and string",
[IsGraphvizGraphDigraphOrContext, IsString],
InstallMethod(GraphvizAddNode, "for a graphviz (di)graph or context and object",
[IsGraphvizGraphDigraphOrContext, IsObject],
function(gv, val)
local node;
val := String(val);

if Length(val) = 0 then
ErrorNoReturn("the argument <val> (the name of the node being added) cannot be empty");
fi;

# Reuse existing node if available
node := GraphvizNode(gv, val);
Expand Down Expand Up @@ -332,11 +337,6 @@ function(gv, name) # gaplint: disable=unused-func-args
"the node's name instead");
end);

InstallMethod(GraphvizAddNode,
"for a graphviz (di)graph or context and string",
[IsGraphvizGraphDigraphOrContext, IsObject],
{x, name} -> GraphvizAddNode(x, String(name)));

#############################################################################
# GraphvizAddEdge
#############################################################################
Expand Down
4 changes: 1 addition & 3 deletions gap/gv.gi
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ InstallMethod(GV_Node, "for a string",
[IsGraphvizGraphDigraphOrContext, IsString],
function(graph, name)
local out;
if Length(name) = 0 then
ErrorNoReturn("the 2nd argument (string/node name) cannot be empty");
fi;
Assert(0, not IsEmpty(name));
out := Objectify(GV_NodeType,
rec(
Name := name,
Expand Down
2 changes: 1 addition & 1 deletion tst/node.tst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gap> n := GraphvizAddNode(GraphvizGraph(), " ");

# Test making a node with empty name fails
gap> n := GraphvizAddNode(GraphvizGraph(), "");
Error, the 2nd argument (string/node name) cannot be empty
Error, the argument <val> (the name of the node being added) cannot be empty

# Test whitespace in node names
gap> n := GraphvizAddNode(GraphvizGraph(), "a a ");
Expand Down
Loading