Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help for solving Graph data structure algorithm problem, the question is as following: We have Directed acyclic Graph we have to find the

I need help for solving Graph data structure algorithm problem, the question is as following: We have Directed acyclic Graph we have to find the number of longest path. If there is any cycle in the graph we have to return a string "cycle found" otherwise we have to return the number of nodes in the longest path. Another key point here is there might be some DA graph that are not connected together.

I'm not sure if I was clear, that's why below I put some example cases. If you look at the table there is a procedure. In the first column the second line contains N names representing the names of each resource. Then on the next N lines: line i contains the name of the parent resource for the resource that has the index i.

Data limits: 1

You can help me with a code in java, Thank you!

image text in transcribed

If you have any other question please leave a commentimage text in transcribed

resources.in resources.out 5 4 Diesel CO2 Plastics Bottles Microplastics Petrol Diesel Petrol Plastics Bottles Petrol Diesel Plastics CO2 Bottles Microplastics resources.in resources.out 4 Cycle detected! ABCD C A B B Base Base B D resources.in resources.out 5 4 Diesel CO2 Plastics Bottles Microplastics Petrol Diesel Petrol Plastics Bottles Petrol Diesel Plastics CO2 Bottles Microplastics resources.in resources.out 4 Cycle detected! ABCD C A B B Base Base B D

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago