Breadth-first search (BFS) is an algorithm used for traversing graph data structures. BFS implements a specific strategy for visiting all the nodes (vertices) of a graph. BFS starts with a node, then it checks the neighbours of the initial node, then the neighbours of the neighbours, and so on.
I’ve created a connected graph with 7 nodes and 8 edges. The edges are undirected and unweighted. Distance between two nodes will be measured based on the number of edges separating two vertices. I use the adjacency list to represent the above graph. An effective/elegant method for implementing adjacency lists in Python is using dictionaries. The keys of the dictionary represent nodes, the values have a list of neighbours.
The following screen shot represents representation of the above graph and output shows the result of running Breadth First Search (BFS) algorithm. Can you explain the output? Can you write program in Python ?
Send your suggestions and comments to email@example.com
Best answer will be rewarded.
Created and edited by Dr. Ashwin I Mehta at Vissicomp Technology
Please check the schedule or reach at http://www.vissicomp.com/
For more details Call us @9320957718 / 17
- Why learn python programming?
Python is one of the most commonly used programming languages. For the past five years, Python has held the number one position as the “most popular coding language.”
- Why Django is the best web development framework for your project?
THERE’S A ROBUST STACK OF FRAMEWORKS WAITING FOR YOU.
Python owes a great deal of its flexibility to the many programming environments and frameworks that make the development of specific applications quick and easy.
For example, web developers can turn to frameworks like Django or Flask, which let you focus on writing the app or site rather than get bogged down by tedious legwork.
DJANGO, A HIGH-LEVEL PYTHON WEB FRAMEWORK, IS FLAT-OUT AMAZING.
The ability to use Django is perhaps one of the biggest advantages of learning Python.
The Django framework lets you model your domain and code classes.
Now you can focus your efforts on your user interface.
- Different ways to change ( configure) Django admin site header text ?
Update admin.py file with following line of code:
Admin.site.site_header=’text you want to change in header of the admin site’
Change url.py file:
Do you want to learn more about DJANGO framework? You can contact us. 9320957718 / 17