I often see my tutor referencing to both adjacency lists and adjacency matrix in Graph theory
But I still don't understand the difference?
Any help please?
            Asked
            
        
        
            Active
            
        
            Viewed 2,563 times
        
    2
            
            
         
    
    
        Ahmed Nabil
        
- 17,392
- 11
- 61
- 88
- 
                    1[This article](https://www.geeksforgeeks.org/graph-and-its-representations/) might help you. – Pyromonk Dec 26 '17 at 04:28
- 
                    Related post - [What is better, adjacency lists or adjacency matrices for graph problems in C++?](https://stackoverflow.com/q/2218322/465053) – RBT Jul 03 '18 at 23:42
1 Answers
4
            Adjacency list shows which nodes are connected to which, in the following format:
2 3 4 5
1 4
1 5 4
1 2 5 3
1 3 4
This means node 1 is connected to nodes 2, 3, 4 and 5, node 2 is connected to 1 and 4, and so on.
The adjacency matrix, on the other hand, does it in the following matrix format:
01111
10010
10011
11101
10110
It shows that if the 1st node and 2nd node are connected, there is a 1 at the grid[1][2] position, and 0 if the 2 nodes aren't connected, or if they are the same nodes.
Hope this helps!
 
    
    
        Asesh
        
- 3,186
- 2
- 21
- 31
 
    
    
        QuIcKmAtHs
        
- 297
- 4
- 18