Network Structures
1. The length of a path in a simple graph is the number of edges on it. The distance between two nodes of a simple graph is the length of the shortest path connecting them. The diameter of a graph is the maximum distance between a pair of nodes. Let 1 , . . . , be all the nodes of a graph G, and let distG(, ) be the distance between and in this graph G. Then the average distance between nodes of G is the number
The distance between the two nodes d(x,y) x and y in the tree is the number of edges in the shortest path between them , The longest path in tree T is either in one of the subtrees of the root x, or it is a path from a leaf of one subtree to x, and a path from x to a leaf in the other subtree, And the diameter is recursively computed as,
diameter(x) = max(diameter(leftsubtree(x)), diameter(rightsubtree(x)), height(leftsubtree(x)) + height(rightsubtree(x)) + 2).
Hence the pseudocode of the recursive algorithm that returns both the diameter and height of the tree rooted at a given node x is as given below :
(int,int) = Diameter(x) { // It returns the (diameter(x) , height(x))
if (x=NIL)
return(-1,-1)
(p,q) = Diameter(leftsub(x))
(r,s) = Diameter(rightsub(x))
v = 1 + max(q,r)
u = max(p,r,q+s+2)
return(u,v) }
If the time complexity is given as T(n) for the tree T having n nodes , The recurrence relation is derived as ,
T(n) <= max {T(i) , T(n − i − 1) : 0 <= i <= n − 1} + c, T(0) = c.
By using induction , T(n) <= cn , Hence T(n) ∈ O(n) .
Network Structures 1. The length of a path in a simple graph is the number of...
Given a directed graph with positive edge lengths and a specified vertex v in the graph, the "all-pairs" v-constrained shortest path problem" is the problem of computing for each pair of vertices i and j the shortest path from i to j that goes through the vertex v. If no such path exists, the answer is . Describe an algorithm that takes a graph G= (V; E) and vertex v as input parameters and computes values L(i; j) that represent...
A certain string is pulled taught between two supports, a distance L apart. When the string is driven at a frequency of 850 Hz a standing wave is observed with n anti-nodes. When the string is driven at 1190 Hz a standing wave is observed with n + 2 anti-nodes. a) What is the fundamental frequency of the set-up? b) What is the numerical value of n? c) The distance between the supports is kept fixed, as is the linear...
You may assume there are exactly simple graphs with vertex set We were unable to transcribe this image1, 2, V3, ..., Unf D)Explain why there are exactly 2) simple grahs with vertex sein which every vertex has even degree. (Hint: Establish a bijection between from this set to the set of all graphs with vertex set {vi, , Vn-1)). 2) Prove that the probability that a randomly chosen simple graph with vertex set {vi,... . vn) wil have an Eulerian...
Have the explaination please. 4 Graph Application: Network Connectivity (Adapted from Problem 9, Chapter 3 of K&T) Think of a communications network as a connected, undi rected graph, where messages from one node s to another node t are sent along paths from s to t. Nodes can sometimes fail. If a node v fails then no messages can be sent along edges incident on v. A network is particularly vulnerable if failure of a single node v can cause...
Data Structures – Test D (Java) Trace Dijkstra’s algorithm starting from for the graph represented in the handout. From the algorithm’s output, determine the shortest path from to ? We were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe this imageTest B To AM 7 6 4 3 2 0 1 11 5 0 From 2 7 7 5 1 2 1 1 7 3 5 4 6 1 5 4 2 6...
Dijkstra’s Algorithm: You have to implement the Dijkstra’s algorithm and apply it on the graph provided below. You have to take the input from the user as an adjacency matrix representing the graph, the source, the destination. Then you have to apply the Dijkstra’s algorithm to find the shortest path from the source and the destination, and find the shortest route between the source and the destination. For the input you have to read it from a file. It will...
A study of emergency service facilities investigated the relationship between the number of facilities and the average distance traveled to provide the emergency service. The following table gives the data collected Number of Facilities 10 15 21 25 29 Average Distance (miles) 1.62 1.19 0.70 0.53 0.43 0.41 a. Choose the correct scatter diagram for these data, treating average distance traveled as the dependent variable A. Distance 1.5 0.5 15 20 25 30 Number 10 We were unable to transcribe...
Length (in days) of human pregnancies is a normal random variable (X) with mean 266, standard deviation 16. (It would be useful to sketch this normal distribution yourself, marking its mean and the values that are 1, 2, and 3 standard deviations below and above the mean. Click to compare your figure to ours) The probability is 0.95 that a pregnancy will last between Select an answer 218 234 250 266 282 298 and Select an answer 218 234 250...
2. Working with Numbers and Graphs Q2 The following graph illustrates the demand (D) curve of an industry as well as the marginal cost (MC) and average total cost (ATC) curves of the only firm in this industry. Refer to the graph to answer the questions that follow. PRICE (Dollars) 70 80 90 100 0 10 20 30 40 50 60 QUANTITY (Units) A We were unable to transcribe this image
4. Given a network of 8 nodes and the distance between each node as shown in Figure 1: 4 1 7 0 4 4 6 6 Figure 1: Network graph of 8 nodes a) Find the shortest path tree of node 1 to all the other nodes (node 0, 2, 3, 4, 5, 6 and 7) using Dijkstra's algorithm. b) Design the Matlab code to implement Dijkstra's algorithm 4. Given a network of 8 nodes and the distance between each...