fixed printgraph to not print duplicates