The answer is N! and I don't understand how it is.
My view:
Assuming it is an undirected graph;
The dimension of each row in a adj. matrix of a vertex is N irrespective of the number of edges. Hence, the number of permutation possible for first row= N!.
Total permutation for second row= (N-1)! since one cell has already been taken care in the first row. Similarly, third row= (N-2)! . . . For Nth row=1
Total permutation= N! + N-1!+...+1!
I am confused if considering an undirected or directed graph will yield different result or not. How will the answer change if we consider graph to be directed?
I'll take a shot at it, but please ask questions if it's unclear. For it to be N!, we are assuming an undirected graph.
For a graph with N vertices, it would be represented with an NxN matrix (2D array) with each value being either 0 (edge does not exist) or 1 (edge exists). In this, we are not considering other weights on edges.
Then, we consider all of the possible assignments. If there are N different choices on the first row, there must be N-1 choices on the second row (since we already know about the edge 1,2) and so on.
N * (N-1) * (N-2) * ... * 1 = N!