×

# Can anyone suggest me how can i find longest chain of nodes ?

 0 Can anyone suggest me how can i find longest chain of nodes in unweighted acyclic graph .It is also given that u can choose any node as a first node. asked 14 Apr '15, 09:47 1●4 accept rate: 0%

 0 If the graph is a DAG, then the first idea that would come into my head is a DP with memoization: DP[v] -> the longest chain starting from vertex v. Then DP[v] = 1+max{DP[w], w in Adj(v)}. You can easily compute this with memoization Your answer is then max{DP[v]} for each vertex If the graph is undirected, then it is a forest of trees, and this is a whole different problem (diameter of a tree) answered 30 Jun '15, 01:54 150●3 accept rate: 12%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,168
×1,656
×1,404
×366
×204
×141
×57

question asked: 14 Apr '15, 09:47

question was seen: 3,679 times

last updated: 30 Jun '15, 01:55