Graph changes

If I'm not mistaken getOrphanNodes was O(N^2), so I brought it down to O(N) (2 passes)
I think this could be valuable if you have a lot of mods installed.