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

  Java program for real estate agent

Write down java program for real estate agent. Program must perform the following tasks: ask users for average house price for the each of past 5 years for single family residence of 1500 square feet.

  Java program to ask user to enter favorite color

Write a Java program to ask the user to enter favorite color, a favorite food, favorite animal, and first name of a friend or relative.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Design and implementation of a hangman game

Design and Implementation of a Hangman game

  Develop a gui based java program

Designing and developing a College Registration program

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  Function using javascript syntax to compute gross pay

Write a function using JavaScript syntax to compute a person's gross pay for a week. The function must receive the number of hours worked and the rate of pay per hour.

  Minimal spanning tree decreasing edge dismissal

Minimal Spanning Tree Decreasing Edge Dismissal, Reverse-delete algorithm. Develop an implementation that computes the MST

  Java method that contains code to be executed

Write a short Java method that contains code for which it is probably impossible for that code to ever be executed, but your favorite Java compiler does not detect this fact.

  Loops and files

Convert an algorithm using control structures into Java and write a while loop

  Implement security so that all users can view the informatio

Implement security so that all users can view the information about the projects, but only authenticated users

  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.

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