.已知連通圖如下
().給出本圖的鄰接表
().若從頂點B出發對該圖進行遍歷在()的基礎上分別給出本圖的按深度優先搜索和按廣度優先搜索的頂點序列
().寫出按深度優先搜索的遞歸程序【廈門大學 三 (%分)】
.試編寫從某一頂點出發按深度優先搜索策略在圖的鄰接表上遍歷一個強連通圖的非遞歸算法(用類PASCAL語言)【燕山大學 十 (分)】
設計算法以實現對無向圖G的深度遍歷要求將每一個連通分量中的頂點以一個表的形式輸出例如下圖的輸出結果為()()()
(注本算法中可以調用以下幾個函數 firstadj(gv)返回圖g中頂點v的第一個鄰接點的號碼若不存在則返回
nextadj(gvw)返回圖g中頂點v的鄰接點中處於w之後的鄰接點的號碼若不存在則返回nodes(g)返回圖g中的頂點數) 【合肥工業大學 五(分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/23103.html