F
F
ff0xff2018-10-28 16:13:06
Algorithms
ff0xff, 2018-10-28 16:13:06

Algorithm to find the longest path in a directed graph?

Good time of the day, tell me the name of the algorithm that allows you to
Find the longest path in a directed graph, where each edge has a weight.
(not using blunt enumeration)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2018-11-01
@ff0xff

In an acyclic directed graph, the simplest is DFS.
A recursive function that returns the longest path from a given vertex. Remembering the answer - if we have already launched from this vertex, we return the already calculated result. Otherwise, iterate over all edges from this vertex and take the maximum of dfs from the end of the edge + the length of the edge. We remember this maximum and return the result.

P
ProfBiss, 2018-10-28
@ProfBiss

You can start your search here Finding the longest path in a directed acyclic...
Longest path problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question