美文网首页
9024 week7 伪代码

9024 week7 伪代码

作者: GhostintheCode | 来源:发表于2018-10-30 11:08 被阅读0次

Computing Connected Components

components(G):
| Input graph G
|
| for all vertices v∈G do
| componentOf[v]=-1
| end for
| compID=0
| for all vertices v∈G do
| | if componentOf[v]=-1 then
| | dfsComponents(G,v,compID) | | compID=compID+1
| | end if
| end for
dfsComponents(G,v,id):
| componentOf[v]=id
| for all vertices w adjacent to v do
|if componentOf[w]=-1 then
|dfsComponents(G,v,id)
|end if
| end for
if componentOf[w]=-1 then dfsComponents(G,w,id)
end if

Algorithm for finding Hamiltonian path:


Exercise #3: Hamiltonian Path

Algorithm to check whether a graph has an Euler path:


Digraph Applications

Exercise #6: Transitive Closure

相关文章

网友评论

      本文标题:9024 week7 伪代码

      本文链接:https://www.haomeiwen.com/subject/iivptqtx.html