For some time, I am using an algorithm that detects the maximum path in complexity O (V + E) For guided Acyalal Graph B indicates from point A. In which nodes are accessible from A, and how many "parents" (the edges that come from other nodes) are in each node, by flood to know Are filling up. Then, I do a BFS but only activate one node when I already used all my "parents".
queue & lt; Int & gt; A complete path []; // The number of paths, which I int int [] []; // mpath edges with an integer []; // Maximum path 0 to i (without calculating the weight of) Fine weight []; The weight of each node mApith / 0 [0] = 0 a pius (0) while not empty (A) for the edge [A] path [I] + = 1 A PUS (i) is not empty (A) I have children For [A] mpath [ii] = max (math [i], math [a] + veet [a]); Path [i] - = 1; If path [i] = 0 a.push (i);
Is there any special name for this algorithm? I told it to an informatics professor, he called it "the maximum path on the dag", but when you say that "I solve the first problem with the Fenwick tree, the second with the twist, and the third with the maximum path".
As mentioned to others, this is simply "the longest way in a drag" however, by you The technology used is actually.
Comments
Post a Comment