tsort object needs to be instance based

The tsort object wasn't an instance, which would cause issues when multiple directed graphs were generated