cmd: added a test case for Graph.detectCycles().
String: greatly simplified hashOfCTF().

* Moved hashOf() above hashOfCTF().