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

  Create a class safestack that implements a stack of strings

Create a class SafeStack that implements a stack of strings

  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

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Write a java program to register students for a college

Project is for designing and developing a College Registration program. Write a Java program to register students for a college

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Implementation of memory management

Implementation of memory management

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

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