Hype is able to compile a domain to a DOT output that can be transformed into a graph image by Graphviz. The output is based on the interaction between the methods and how they decompose, not just the operators. Even simple HTN domains can generate complex graphs. Here the basic JSHOP domain description is used as an example of how to obtain and read a graph.
(defdomain basic (
(:operator (!pickup ?a) () () ((have ?a)))
(:operator (!drop ?a) ((have ?a)) ((have ?a)) ())
(:method (swap ?x ?y)
((have ?x) (not (have ?y)))
((!drop ?x) (!pickup ?y))
((have ?y) (not (have ?x)))
((!drop ?y) (!pickup ?x)))))
Which is converted to a DOT description using the following command.
cd HyperTensioN
ruby Hype examples/basic/basic.jshop examples/basic/pb1.jshop dot
Complex DOT descriptions are not intended to be generated and read by humans, as one can see:
// Generated by Hype
digraph "basic" {
nodesep=1.0
ranksep=1.0
// Operators
"pickup" [
shape=record
label="{{pickup|?a}|{|(have ?a)\l}}"
]
"drop" [
shape=record
label="{{drop|?a}|{(have ?a)\l|not (have ?a)\l}}"
]
// Methods
"swap" [
shape=Mrecord
style=bold
label="{{swap|?x ?y}|{<n0>swap_0|<n1>swap_1}}"
]
"label_swap_0" [
shape=Mrecord
label="{{swap_0|}|(have ?x)\lnot (have ?y)\l|<n0>drop ?x|<n1>pickup ?y}"
]
"swap":n0 -> "label_swap_0" [style=dotted]
"label_swap_0":n0 -> "drop"
"label_swap_0":n1 -> "pickup"
"label_swap_1" [
shape=Mrecord
label="{{swap_1|}|(have ?y)\lnot (have ?x)\l|<n0>drop ?y|<n1>pickup ?x}"
]
"swap":n1 -> "label_swap_1" [style=dotted]
"label_swap_1":n0 -> "drop"
"label_swap_1":n1 -> "pickup"
}
Which results in the following image using the dot layout, with methods, cases and operators. The bold rounded rectangle is a method, with name, parameters and two decompositions. Each decomposition is a case to be evaluated by the HTN planner, a rounded rectangle containing a name (optional in JSHOP, generated when not given), free variables to be unified at run-time, preconditions and a sequence of operators. The operators are the rectangles containing name, parameters, preconditions and effects.