Refactor termgraph.py to support library calls (with README updates)