Fixed graph generation; added graph generation tests.