With this algorithm, we are converting the adjacency list in the .txt file to a singly linked list and travers the nodes with BFS algorithm.
Examine the attached image to see the structure created by the algorithm.
The nodes on the left, seen in the picture and in the .txt file, are expressed as the main node in the code.
The nodes on the right are expressed as the adjacent nodes in the code.
Note: Not all nodes fit in the picture. After that, these nodes being added to the queue with the help of the adjacency list structure. BFS algorithm uses this queue.