dia to sml: improve design by contract in grapher

- make precondition checks doable from the outside
- ensure we throw if building a built graph
- add test for checking state of a non-built graph