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

  A jsp expression can contain any java expression

A JSP expression can contain any Java expression that evaluates to a

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  Write java program to reads ten values from user

Write the java program which reads 10 values from user and store them in 1 daimantion array. your program will ask the user wich operation he wants to perform:

  Create a project in eclipse

Create a new project

  Modeling the caves

Assignment 2 Description:  You are a mighty warrior, and armed with your trusty bow and 3 arrows, you enter The Caves in search of the mighty Wumpus. If you shoot the Wumpus, you are victorious and the masses will praise you, but if you stumble upon ..

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Web engineering principles

web application development, Web Engineering methodology, UML-based Web Engineering (UWE), models to the expansion of web applications, Object Oriented Web Solutions (OOWS),Web Modeling Language (WebML) methodology, Object-Oriented Hypermedia Design..

  Implementation activities of software development

Analysis, design, and implementation activities of software development

  Solving programming problems

Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.

  Create a driver class in java

Your project is to create a driver class that uses SuperJavaIceCreamClass.

  Implementation the two classes

Program Specifications: In the new implementation, the two classes, Student and Grades, are defined with the following operations/methods.

  Create java program to find number of days left in that year

Create a Java program called "DaysLeftInYear.java" that outputs the number of days left in that year. use the calendar class to represent dates. Use the DateFormat class to display the current date in the output.

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