If the index is 1 , increment the row we are checking by 1 else increment the column
if self . adjacency_matrix [ i ] [ j ] == 1 : NEW_LINE INDENT i += 1 NEW_LINE DEDENT else : NEW_LINE INDENT j += 1 NEW_LINE DEDENT