Java program use breadth-first search closest broadcast

Assignment Help JAVA Programming
Reference no: EM1370648

Write a java program that will use breadth-first search (that you implement as part of your program) to find the closest broadcast vertex for each vertex in a graph. The graph represents a communication network, with vertices representing nodes in the network and edges representing links in the network. Some of the vertices are designated as broadcast, to indicate that any message arriving at the network will be broadcast from there; all entering messages would be broadcast from all such vertices simultaneously. What we would like to determine is, for each vertex in the graph, which of the broadcast vertices is the closest to it. Distance is measured by the number of links in the shortest path between nodes. If a vertex is itself a broadcast vertex, than it would be its own closest such vertex.

The graph is given by its adjacency list (input as discussed below), where all vertices are numbered with consecutive integers, starting at 0. Input specification: The input should be read from standard input. The first line of the input will be two integers, indicating the number of vertices n and the number of edges m. The second line lists the indices of the broadcast vertices. Each of the following m lines lists a pair of indices that correspond to the vertices of an edge.
Example input:

7 8
0 1 2
0 1
0 4
0 5
1 3
2 3
2 4
3 4
3 5

Output specification: The output should be written to standard output. It should consist of a single line that gives, in ascending vertex index order, which broadcast vertex is the closest for each vertex in the graph. Ties should be broken by giving the closest broadcast vertex with the smallest index. If there is no broadcast vertex that can reach a vertex, print N. Example output:

0 1 2 1 0 0 N

You can assume that the input is correct according to the specification. Hand in on paper: your source code, and three sample input/output file pairs. 

Reference no: EM1370648

Questions Cloud

Question about online bill payment : The Wall Street Journal reported that businesses are aggressively pushing customers to pay their bills electronically. Numerous banks dropped their monthly fee for online bill paying,
Advantages of herfindahl index over concentration ratios : What are the advantages of the Herfindahl index over concentration ratios in measuring degrees of concentration in an industry? (b) What is the disadvantage of both?
Write program using array to show fifo queue : Write program using any language which uses the array to demonstrate simple FIFO queue with 10 job entering the queue and 5 jobs removed from the queue by the server.
Calculate a country money supply : Assume the entire economy contains $5000 worth of one-dollar bills. If people fail to deposit any of the dollars, but instead hold all $5000 as currency, how large is the money supply?
Java program use breadth-first search closest broadcast : Write the java program which will use breadth-first search (which you implement as part of your program) to determine the closest broadcast vertex for each vertex in graph.
Description of monopolistic competition : A restaurant industry has a market structure that comes closest to
Differences between monopolistic competition-pure monopoly : If the economy is at point C, what is the cost of one more automobile? One more rocket? Explain how the production possibilities curve reflects the law of increasing opportunities costs
Calculate atm fees : A bank in a mediumsized Midwestern city, Company X, currently charges$1 per transaction at it's ATM's. To determine whether to increase price,
Conflicts of interest faced by an investment advisor : Discuss and explain two conflicts of interest faced by an Investment Advisor who is employed by a commercial bank or an investment bank?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a java class called samearraysexception

Create a Java class called SameArraysException that extends the Exception class.

  Write java application to input three integers from user

Write Java application that inputs three integers from user and displays sum, average, product, smallest, and largest of the numbers.

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Implement simple java program to input syllabus grades

To implement simple Java program to input (hypothetical) syllabus grades, computing and displaying both normal Mean and Harmonic Mean.

  Java program simulate a network

Java program simulate a network

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

  Create your own date class

You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program:

  Design a course registration system

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Develop a gui based java program

Designing and developing a College Registration program

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd