我試圖理解描述here的算法,但解釋真的不是很清楚:如何使用循環尋找算法找到歐拉路徑?
'tour' is a stack
find_tour(u):
for each edge e=(u,v) in E:
remove e from E
find_tour(v)
prepend u to tour
to find the tour, clear stack 'tour' and call find_tour(u),
where u is any vertex with a non-zero degree.
什麼意思「前面加上」 u
到堆棧? tour
中的元素如何用於find_tour
?如果有人能向我解釋,會很高興,謝謝!
閱讀我的博客,尋找無向圖的歐拉軌跡。 Hierholzer算法運行良好。 http://jeewanthad.blogspot.com/2012/11/eulerian-trail.html – Jeewantha 2012-12-04 05:11:14