perform 1st phase and generate diagram