Better random numbers. Introduced subgraph type in preparation for divide and conquer.