So, the task says determine the adjacency matrix for a tree whose Prüfer code is (1, 2, 3, 4, 5, 6).
I don't know how I could write a graph with only knowing one set of Prüfer code numbers, and therefore I don't know how to get adjacency matrix.
Any help is greatly appreciated!
The given Prüfer code $(1, 2, 3, 4, 5, 6)\,$ has length $\,n-2=6$, thus it encodes a labelled tree with $n=8$ nodes.
Prüfer's key fact is that the second row uniquely determines the first row of the extended Prüfer code.
Both variants are paths.
Added in Edit: Review of the 1-to-1 correspondence between labelled trees and Prüfer codes
Encoding: Tree $\longmapsto$ Code
Recall the specific of a tree that for two nodes there is a unique path connecting them. When tagging one node as ancestor, or root, then for any edge the involved vertices can be distinguished as the parent, who is nearer to the ancestor, and the child, being farther away.
Now consider a tree with $n$ nodes labelled from $0$ to $n-1$ and choose $0$ as the ancestor. The extended Prüfer code is a listing of all the $n-1$ edges in an algorithmically determined order, such that the child node is in the upper row, above its parent node in the lower row.
Algorithmic step to be repeated (until the ancestor alone is left):
Look out for the lowest-labelled child node which is not a parent node, and add its edge to the list. Then delete the edge and its child node from the graph.
Carrying out this for the tree $\ 0\ \frac{\quad}{}\ 6\ \frac{\quad}{}\ 5\ \frac{\quad}{}\ 4\ \frac{\quad}{}\ 3\ \frac{\quad}{}\ 2\ \frac{\quad}{}\ 1\ \frac{\quad}{}\ 7\ $ results in $$\begin{matrix} 7&1&2&3&4&5& 6\\ 1&2&3&4&5& 6&0 \end{matrix}$$ In the lower right corner you always end up with the ancestor. Now the lower/parent row alone, truncated by the ancestor, is the Prüfer code.
Decoding: Code $\longmapsto$ Tree
A given Prüfer code let's you build up the corresponding tree in the same order in which the edges were deleted during encoding, i.e., from left to right.
Append zero to the code for the ancestor. Then look at the first entry $p_1$ which is the parent node of the initially deleted edge. Hence the corresponding child node has the lowest possible label which is not also a parent label. Which means this label must not occur to the right of $p_1$.
The algorithmic step in general is essentially the same:
Considering a parent node $p$, watch out for the lowest label which does not occur to the right of $p$ and which has not already been picked as child label.
Following this prescription the given $(1, 2, 3, 4, 5, 6)$ returns the labelled tree $$\ 0\ \frac{\quad}{}\ 6\ \frac{\quad}{}\ 5\ \frac{\quad}{}\ 4\ \frac{\quad}{}\ 3\ \frac{\quad}{}\ 2\ \frac{\quad}{}\ 1\ \frac{\quad}{}\ 7\ $$ And for encoding and decoding in general:
Going back-and-forth, and forth-and-back, are the identity mappings since what has been described are mutual inverse bijections.
This is one track towards a proof of Cayley's theorem: There are $n^{n-2}$ labelled trees with $n$ nodes.
Notice that the preceding differs from the wikipedia entries (at least those in French, German, and English), well, but Prüfer's core idea is throughout the same.
I learnt this stuff from the book "Discrete Mathematics" by Lovász, Pelikán, and Vesztergombi (Springer 2003), see §8.4 "How to store trees" therein. And I'd recommend that read.
By the way, searching for "[graph-theory] Prüfer" on math.SE currently gives 81 results.