page548.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 43 行
HTML
43 行
<HTML><HEAD><TITLE>Graph Traversals</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html7459" HREF="page549.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7457" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7451" HREF="page547.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7461" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION0016300000000000000000">Graph Traversals</A></H1><A NAME="secgraphtraversals"> </A><P>There are many different applications of graphs.As a result, there are many different algorithms for manipulating them.However, many of the different graph algorithms have in commonthe characteristic that they systematically visit all the vertices in the graph.That is, the algorithm walks through the graph data structureand performs some computation at each vertex in the graph.This process of walking through the graph is called a<em>graph traversal</em><A NAME=49905> </A><A NAME=49906> </A>.<P>While there are many different possible ways in which tosystematically visit all the vertices of a graph,certain traversal methods occur frequently enough that theyare given names of their own.This section presents three of them--depth-first traversal, breadth-first traversaland topological sort.<P><BR> <HR><UL> <LI> <A NAME="tex2html7462" HREF="page549.html#SECTION0016310000000000000000">Depth-First Traversal</A><LI> <A NAME="tex2html7463" HREF="page552.html#SECTION0016320000000000000000">Breadth-First Traversal</A><LI> <A NAME="tex2html7464" HREF="page555.html#SECTION0016330000000000000000">Topological Sort</A><LI> <A NAME="tex2html7465" HREF="page558.html#SECTION0016340000000000000000">Graph Traversal Applications:<BR> Testing for Cycles and Connectedness</A></UL><HR><A NAME="tex2html7459" HREF="page549.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7457" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7451" HREF="page547.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7461" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright © 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?