Question: In this class, you should implement the following methods: [ 3 0 points ] crawlAndIndex This method takes a String as input representing a url.

In this class, you should implement the following methods:
[30 points ] crawlAndIndex
This method takes a String as input representing a url. Starting at the given url, the method performs an exploration of the web while building the web graph that represents it. You can use ideas from either a depth-first search or a breadth-first search, and you can make this method either recursive or non-recursive. For each url explored, the method should do the following:
Update the web graph by adding the appropriate vertex and edges.
Update the word index so that every word in the url just visited appear in the mapping.
Note that, it is possible for the graph to contain cycles. For instance, if it possible that two web pages link to each other. To prevent this method from getting stuck in an infinite loop, you should make sure to keep track of which web page has already been explored. This method should stop crawling once all web pages (in the database) have been explored.
Please note that your word index should not be case sensitive, that is words such as "Hello", "hello", or "hElLo" should all be considered the same. You should also make sure that the elements (i.e. the urls) in the lists to which each word maps to should be unique.
In this class, you should implement the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!