added G array to generate_Subpath