Answered step by step
Verified Expert Solution
Question
1 Approved Answer
No AI generated answers please. Introduction The Internet can be viewed from both physical and logical perspectives. From a physical point of view, the Internet
No AI generated answers please.
Introduction
The Internet can be viewed from both physical and logical perspectives. From a physical point of view, the Internet is a collection of web servers connected together with fibre optic cables. From a logical point of view, the Internet is a collection of webpages connected together with hyperlinks. For this assignment, both perspectives are modeled as graphs in the following ways.
Server Graph
The collection of servers, on one hand, is represented
by an undirected, unweighted server graph S V E
where:
each vertex s E V represents a web server and
each undirected edge s t E represents the physical connection between servers and server t
Each server has a unique name and a list of the webpages that it hosts. Also, there is no hard limit on the number of servers.
Web Graph
The collection of webpages, on the other hand, is represented by a directed, unweighted web graph W V E where:
each vertex u V is a webpage and
each directed edge u v E is a hyperlink from webpage u to webpage v To simplify our discussion, there is at most one hyperlink from u to v
Each webpage has a unique name as well as the name of the server that hosts it
Task : Web Graph marks
Using the partial definitions below, implement and test the web graph as an expandable adjacency list.
marks
public class WebPage
public string Name get; set; public string Server get; set; public List E get; set;
public WebPagestring name, string host public int FindLinkstring name
public class WebGraph
private List P;
marks
I Create an empty WebGraph public WebGraph
marks
Return the index of the webpage with the given
name; otherwise return private int FindPagestring name
marks
Il Add a webpage with the given name and store it on the host server
Return true if successful; otherwise return false
public bool AddPagestring name, string host, ServerGraph S
marks
Remove the webpage with the given name,
including the hyperlinks
from and to the webpage
Return true if successful; otherwise return false
public bool RemovePage string name, Server Graph S
marks
I Add a hyperlink from one webpage to another
Return true if successful; otherwise return false
public bool AddLink string from, string to
marks
Remove a hyperlink from one webpage to another
Return true if successful; otherwise return false
public bool RemoveLink string from, string to
marks
Return the average length of the shortest paths from
the webpage with
Il given name to each of its hyperlinks
Hint: Use the method ShortestPath in the class
ServerGraph
public float AvgShortestPathsstring name, ServerGraph S
marks
Print the name and hyperlinks of each webpage
public void PrintGraph
Task : The Main marks
The server and web graphs define the physical and logical models of the Internet and work in tandem to reflect the same reality. In the main program, an instance of each graph is instantiated and the following steps are carried out to exercise your program. Ensure that both successful and unsuccessful cases are tested.
Instantiate a server graph and a web graph.
Add a number of servers.
Add additional connections between servers.
Add a number of webpages to various servers.
Add and remove hyperlinks between the webpages.
Remove both webpages and servers.
Determine the critical servers of the remaining Internet.
Calculate the average shortest distance to the hyperlinks of a given webpage.
Testing and Documentation marks
In a separate document, illustrate your test cases and compare them with the results of your program.No
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started