Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given two nodes v and u in a connected, undirected graph G = , their distance is the length of the shortest path between v

Given two nodes v and u in a connected, undirected graph G = , their distance is the length of the shortest path between v and u (here each edge is of length 1). The remoteness of a node is its distance to the node furthest away, that is, rem(v) = max{dist (v, u) | u V }. A hub in G is a node which has minimal remoteness, compared to all other nodes. That is, v is a hub iff rem(v) = min{rem(u) | u V }. For example, b is a hub in the graph on the left (below), whereas b, d and e all are hubs in the graph on the right. Note that a connected graph always has at least one hub.

image text in transcribed

(a) Using pseudo-code, design a function that, given a connected undirected graph and a node v V , determines all distances from v, that is, for each u V , gives dist(v, u). Assume that nodes are labelled 1 to n, so that your function can return an array dist with dist [i] giving is distance to v. The algorithm should run in time that is linear in the size of the graph.

(b) Design an algorithm that, given a connected undirected graph , identifies a hub (any hub) in the graph. More precisely, use pseudo-code to define a function Hub that takes as input and returns a node which is a hub. Aim for an O(n2) algorithm, where n is the size of the graph.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Summarize the types of job analysis information.

Answered: 1 week ago

Question

Define Administration and Management

Answered: 1 week ago