Implicit Representation : For some graphs,the graph itself does not have to be stored.
Edge List : List of pairs of vertices.
Ex : (1,3),(2,3),(3,3),(5,3),(4,5),(2,4),(1,2)
Adjacency Matrix : This is a N* (N array). N is the number of vertices. If node i is connected to node j then adj[i][j] = 1 else adj[i][j]=0. Ex :
Sometimes a grid can also be a good representation.
Adjacent List : Keep track all the edges incident to a given vertex and do this for all vertex. Ex :
1 : 3,2 2 : 3,4 3 : 3 4 : 5 5 : 3
A graph making website: https://csacademy.com/app/graph_editor/
No comments:
Post a Comment