Question: Java algorithm : Use BFS to implement a crawler to crawl and discover the wikipedia graph. Called WikiCrawler.java 1 BFS and Web Graph We can
Java algorithm: Use BFS to implement a crawler to crawl and discover the wikipedia graph. Called WikiCrawler.java





1 BFS and Web Graph We can the model web as a directed graph. Every web page is a vertex of the graph. We put a directed edge from a page p to a page q, if page p contains a link to page q. Recall the BFS algorithm from the lecture 1. Input: Ditrected Graph G V.E, and root e V. 2. Initialize a Queue Q and a list visited. 3. Place root in Q and visited. 4. while Q is not empty Do (a) Let v be the first element of Q (b) For every edge ?v,u) e E DO If uvisited add u to the end of Q, and add u to visited. If you output the vertices in visited, that will be BFS traversal of the input graph. We can use BFS algorithm on web graph also. Here, the input to the algorithm is a seed url (instead of entire web graph). View that page as the the root for the BFS traversal. Here is the BFS algorithm on Web graph
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
