Make python scripts use less memory by only calculating needed paths

... no all of them. This drops the memory usage from 10G to 1G when running the python scripts using networkX.

Print out template type if class is a template specialization.