Correcting generation of graphs, which previously had problems around
(un)qualified node names not matching. Needs a bit more checking, and
refactoring.
Tidied the graph-generation code. Also changed all edge weights to 1.
Refactored internals of graph command.