Using a linked implementation of graph write a method

Assignment Help JAVA Programming
Reference no: EM134303

Using a linked implementation of graph write a method that takes two nodes as input and returns true if joining an edge between these two nodes, forms a duplicate path to one of the input nodes within the graph. Else the method must return false. Suppose that it is known that an edge does not exist between the input nodes. You may have to add an additional field to a graph node which holds the parent. Provide two input nodes trace the ancestors and compare them to see if there is a common ancestor. If a common ancestor is found then your method must return true.

The input must be read through a file. The first line of the input must indicate the number of nodes in the graph. If you have 5 nodes suppose that the nodes will be numbered I through 5 (Figure is an example). After first line every other line must have two integer values, the two values show the source and target of the node (it's a directed graph). Sample input for figure 3 graph is

Sample input:

5

1 2

1 3

1 4

1 5

3 5

4 2

In figure is an edge was being added between nodes 3 and 2 then there is a duplicate path to node 2 from node 1, so the function must return true.

265_Using a linked implementation of graph write a method.png

41_Using a linked implementation of graph write a method1.png

Reference no: EM134303

Questions Cloud

Bsg online game : The BSG ONLINE GAME What is good about the game and why? What are the weaknesses of the game and why?
Which were the main options available to the nokia firm : Which were the main options available to the Nokia firm in terms of growth? Why do you think the company decided to innovate following a specific route?
Critical view of national innovation system : Give your personal and critical view of National Innovation System (NIS) in US.
Summarizes and organizes the literature : Summarizes and organizes the literature related to the chosen issue or problem.
Using a linked implementation of graph write a method : Write a method that takes two nodes as input and returns true if joining an edge between these two nodes, forms a duplicate path to one of the input nodes within the graph.
New product development : You are required to submit a written assignment relating to New Product Development.
Implementation of graph : Give the two input nodes after the graph has been built from the command prompt.
Econ 301 assignment : Econ 301 Assignment, Find at least three other variables that may affect the return of equity of your choice
Find the purchase prices of these materials : Factory X produces a single product which is made from 10 kg of Material A as well as 5 kg of Material B. These quantities allow for waste The purchase prices of these materials

Reviews

Write a Review

JAVA Programming Questions & Answers

  Print the contents of the array

Prepare a second loop that prints the contents of the array

  Record managing system application

Build a student record managing system application

  Build the gui layout of the game

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

  Create four classes

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Write a program that shows the current time and date

Write a program that shows the current time and date

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  File integrity checker - tripwire

Write a program that will perform some of the basic tasks accomplished by a file integrity checker such as Tripwire.

  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.

  Mean and standard deviation using using eclipse

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

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

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