Adjacency list representation of graph
In Programming language graph is represented in a two ways. Such as Adjacency list Adjacency matrix. In this post are mentioning example of Adjacency list of Directed and Undirected graph.
Directed Graph Adjacency list
Here given code implementation process.

1) Adjacency list representation of directed graph in c
2) Adjacency list representation of directed graph in cpp
3) Adjacency list representation of directed graph in java
4) Adjacency list representation of directed graph in c#
5) Adjacency list representation of directed graph in php
6) Adjacency list representation of directed graph in golang
7) Adjacency list representation of directed graph in kotlin
8) Adjacency list representation of directed graph in swift
9) Adjacency list representation of directed graph in scala
10) Adjacency list representation of directed graph in python
11) Adjacency list representation of directed graph in ruby
12) Adjacency list representation of directed graph in typescript
13) Adjacency list representation of directed graph in node js
14) Adjacency list representation of directed graph in vb.net
UnDirected Graph Adjacency list

1) Adjacency list representation of undirected graph in java
2) Adjacency list representation of undirected graph in c
3) Adjacency list representation of undirected graph in c++
4) Adjacency list representation of undirected graph in go
5) Adjacency list representation of undirected graph in csharp
6) Adjacency list representation of undirected graph in vb.net
7) Adjacency list representation of undirected graph in php
8) Adjacency list representation of undirected graph in node js
9) Adjacency list representation of undirected graph in typescript
10) Adjacency list representation of undirected graph in python
11) Adjacency list representation of undirected graph in ruby
12) Adjacency list representation of undirected graph in scala
13) Adjacency list representation of undirected graph in swift
14) Adjacency list representation of undirected graph in kotlin
Note that in both example first use an array which are contain actual node values. Array is useful to get any node quickly in existing array. When graph nodes are not predefined or you are remove existing graph node then array are not suitable here.
Because after create array, In most of programming language are not allowing to resize the array size such as add or delete existing node. In this case you'll can use linked list to storing the value of actual graph node.
Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.
New Comment