Write a program that should accept a file as input

Assignment Help Data Structure & Algorithms
Reference no: EM131290607

Assignment

For this assignment, your program should accept a file as input. First line in the input file contains the label of the source node. Then each subsequent line has the edges of a directed graph. Nodes are labeled as integers from 1 to 500 (maximum 500 nodes). Each row indicates an edge, the node label in first column is the tail and the node label in second column is the head. For example, the 2nd row looks Mot "1 2". This means the node with label 1 has an outgoing edge to the node with label 2.

Your task is to write a code (using BFS or DFS) to compute the shortest path between a source note,to all other nodes. Your output should contain the label for each node, and the shortest distance to that node from the source. For example, first row in the sample output indicates that the shortest distance from source node to node 2 is 1. And the last line indicates that the shortest path from source node to node 6 is 4.

Reference no: EM131290607

Questions Cloud

Subcontractor to do the mowing : Jack owns a lawn mowing company. His company contracts to provide lawn mowing services to Rachel. Jack hires a subcontractor to do the mowing. Which of the below statements is correct?
How can we reduce poverty in the united states : How can we reduce poverty in the United States?Will receiving a college degree improve your career opportunities?
Explain the usefulness of motivation theories : Share examples of how these theories have been exemplified in your personal life. Finally, explain the usefulness of motivation theories in your work as an education professional.
Analyze and evaluate the website presentation of the issues : analyze one website and design a full-size poster presentation to analyze and evaluate the website presentation of the issues.
Write a program that should accept a file as input : For this assignment, your program should accept a file as input. First line in the input file contains the label of the source node. Then each subsequent line has the edges of a directed graph.
Business model generation : In reference the book "Business Model Generation" by Alexander Osterwalder & Yves Pigneur, how does "Brainstorming New Business Models" by answering the What if questions impact successful businesses?
Visit and experience your artifact : Develop an outline for a detailed description of the object and its setting. Help your reader visualize the object in detail. Avoid assumptions. This section requires close direct experience, not research. Include at least four observations.
Calculate the gross proceeds per share : Howett Pockett, Inc., plans to issue 10.4 million new shares of its stock. In discussions with its investment bank, Howett Pocket learns that the bankers recommend a net proceed of $34.60 per share and they will charge an underwriter's spread of 5..
Explain what nature is according to that philosopher : Nature and Western Philosophy : Meta­ physical aspects of the current crisis.Research any non­Western philosopher of your choosing (e.g. a Chinese, Japanese, Indian, African / African diaspora or indigenous philosopher)and explain what nature is ac..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Compute a shortest-path

Compute a shortest-path from u to v (instead of from u to all the nodes). One way to speed up Dijkstra's algorithm might be to run the algorithm u and from v at the same time.

  Illustrate influence of virtual memory management

Design a program that illustrates the influence of virtual memory management on execution. Specifically, for a computer platform that uses VMM, determine the size of the active memory set and the access characteristics of the components involved i..

  Quality building supply qbs has proposed a project to

quality building supply qbs has proposed a project to develop a business system. the project team has gathered the

  Explain binary tree by induction

Binary tree is full if all of its vertices have either zero or two children. Let Bn denote number of full binary trees with n vertices. Illustrate by induction (substitution) that Bn is 2 (n) .

  Using b-tree of order three shown in figure add given number

Using the B-tree of order 3 shown in Figure, add 50, 78, 101, and 232. Using the B-tree of order 3 shown in Figure, delete 63, 90, 41, and 60. Using the B-tree of order 3 shown in Figure, add 50, 78, 101, and 232.

  Threat model to describe risk of attack vector

Construct a simple threat model that describes the risk this represents: attacker(s), attack vector, vulnerability, assets, and likelihood of occurrence, likely impact, and plausible mitigations.

  Determine the number of peaks and valleys in given terrain

Problem: Navigation over a terrain can be an important concept. Usually you want to avoid high areas (peaks) and low areas (valleys) -

  Construct two gene expression clustering algorithms using r

CLUSTERING GENE EXPRESSION DATA USING R LANGUAGEConstruct two gene expression clustering algorithms using R.Select the best algorithm and construct a third improved algorithm.

  1decryption speeda certain cryptography vendor was

1.decryption speeda certain cryptography vendor was providing an encryption technology that was breakable within 10

  Test the database management system functionality

In a report that less than half of all companies validate the in their databases and test database management system's functionality. Explain your answer.

  Write a program that will perform the same operations twice

Write a program that will perform the same operations twice, once using an array of structs, and once using a pair of parallel arrays. The data will represent people's names and ages, so the first data structure will be an array of structs.

  Show steps needed to look up ann arbor using binary search

Show steps needed to look up Ann Arbor using binary search on the following list: Ann Arbor, Berkeley, Cambridge, Eugene, Madison, New Haven, Pasadena, Santa Cruz, Stony Brook, Westwood, and Yellow Springs.

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