adjacency matrix
RU: матрица смежности
A graph representation using a V×V matrix where cell [u][v] = 1 (or weight) if edge (u,v) exists, else 0. Space: O(V²), edge lookup: O(1).
RU: матрица смежности
A graph representation using a V×V matrix where cell [u][v] = 1 (or weight) if edge (u,v) exists, else 0. Space: O(V²), edge lookup: O(1).