Adjacency tables, how do they work?

184 Views Asked by At

I'm struggling to find out how adjacency tables work. I just have no idea where they get the numbers from. Here's an example: enter image description here

I've kinda figured out just by looking at the graphs and numbers how they get the numbers from 7-22, but after that I'm completely lost. Can anyone help explain this to me?

Thanks!

2

There are 2 best solutions below

2
On BEST ANSWER

Say you want to read the adjacent vertices to $v_5$. Note that this is a pretty funny system, an adjacency matrix is much easier to read.enter image description here

0
On

Apparently, for each vertex, the adjacent vertices are placed in a linked list. That is, each element in the linked list contains a vertex and a link to the next element in the list, or else $0$ to indicate the end of the list. An example is vertex $v_1$ points to index $7$ in the list where we find $(v_2,0)$ which indicates that $v_1$ is only adjacent to $v_2$. Next example is vertex $v_2$ which points to index $8$ in the list where we find $(v_1,9)$ and list element $9$ is $(v_3,10)$, list element $10$ is $(v_4,11)$ and finally list element $11$ is $(v_5,0)$. Thus the vertex $v_2$ is adjacent to $v_1,v_2,v_4,v_5$. You just have to follow the links in the list until you get a link of $0$.