Diagrams can be represented by graphs, and the animation and transformation of diagrams can be modeled by graph transformation. This paper studies extensions of graphs and graph transformation that are important for programming with graphs:
\bullet We extend graphs by a notion of hierarchy that supports value composition, and define hierarchical graph transformation in an intuitive way that resembles term rewriting.
\bullet We require that admissable shapes for hierarchical graphs are specified by context-free graph grammars, in order to set up a type discipline for shapely hierarchical graph transformation.
The resulting computational model shall be the basis of the visual language DIAPLAN for programming with graphs that represent diagrams.