Tarjan 複習小結

2022-03-19 20:28:12 字數 777 閱讀 5888

一、割點。

void tarjan(r i,r rt)

else low[i]=min(low[i],dfn[to[k]]);

} if(i==rt&&sum>1)ans[i]=1;

}注意 在不聯通圖中,應當

for(r i=1;i<=n;++i)if(!dfn[i])tarjan(i,i);

這樣才能保證全部求到,注意根節點.

二、橋。
void tarjan(r i,r id)

else low[i]=min(low[i],dfn[to[k]]);

}}

三、強聯通和雙聯通一點區別。

四、強聯通分量。

void tarjan(r i)

if(dfn[i]==low[i])

}

五、邊雙。
void tarjan(r i,r id)

else low[i]=min(low[i],dfn[to[k]]);

}}

upd on 10.31
void tarjan(r i,r op)

if(dfn[i]==low[i])

}

六、點雙
void tarjan(r i,r rt)

else low[i]=min(low[i],dfn[to[k]]);

} if(i==rt&&sum>1)ans[i]=1;

}

七、小清新水題。

tarjan複習小結

雖然是複習,但還是學到許多。過程中遇到四種邊 1 樹枝邊 dfs 搜尋樹上的邊 滿足邊 u,v v 不在棧中 u 為 v 的父節點 2 前向邊 與 dfs 方向一致 祖先指向子孫 沒什麼用 3 後向邊 與 dfs 方向相反 子孫指向祖先 滿足邊 u,v v 在棧中,u 為 v 的祖先節點 4 橫叉邊...

tarjan複習筆記

tarjan求強連通分量 割點總體思想 遍歷每乙個結點並使用並查集記錄父子關係。tarjan 是一種dfs的思想。我們需要從根結點去遍歷這棵樹。當遍歷到某乙個結點 稱之為 x xx 時,你有以下幾點需要做的。將當前結點標記為已經訪問。遞迴遍歷所有它的子節點 稱之為 y yy 並在遞迴執行完後用並查集...

Tarjan專題總結複習

dfn x x 第一次被訪問的時間順序 時間戳 搜尋樹 每個節點只訪問一次,所有訪問過的邊 x,y 構成一棵搜尋樹 low x 定義為以下節點的時間戳的最小值 1.subtree x 中的節點。2.通過 1 條不在搜尋樹上的邊,能夠到達 subtree x 的節點。void tarjan int x...