1
Suppose I have such graph:
SeedRandom[3];
g = GridGraph[{5, 6}];
graph = Graph[RandomSample[VertexList@g], EdgeList@g,
VertexLabels -> "Name"]
Of course we don't know the matrix dimension is {5,6} in advance.How to get such matrix?
$$\left(
\begin{array}{cccccc}
26 & 21 & 16 & 11 & 6 & ...