多段グラフ問題については、「FundamentalsofComputerAlgorithms」の本を調べていました。
それは言う:
Algorithm Graph(G,k,n,p)
{
cost[n]=0;
for j=n-1 to 1 step -1 do
{
Let r be a vertex such that<j,r> is an edge of G and c[j,r]+cost[r] is minimum
cost[j]=c[j,r]+cost[r]
}
}
著者は、複雑さはO(| V | + | E |)であると述べています。ここで|V| は頂点の数であり、| E | はエッジの数です。
forループは頂点の総数に対して実行され、内側の線は近端を選択する必要があることを知っています。
背後にある論理を理解できませんでした