This example shows how to draw a grid graph, defined by a set of vertices with integer coordinates, where edges usually connect all vertices at distance 1. However, to enable drawing specific paths (e.g. Hamiltonian paths/cycles), the edges are explicit in the ASCII input.
Fig. 2.7 from Itai, Papadimitriou, and Szwarcfiter 1982
return path | cross path |
---|---|
ASCII input, SVG output | ASCII input, SVG output |
Fig. 2.8 from Itai, Papadimitriou, and Szwarcfiter 1982
- These examples use flip_parity.js to flip the parity of the vertex coloring, to match the figure in the paper.
- Illustrating the use of
svgtiler.def
to instantiate<marker>
.