page569.html
来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 41 行
HTML
41 行
<HTML><HEAD><TITLE>All-Pairs Source Shortest Path</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="tex2html7696" HREF="page570.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7694" HREF="page563.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7690" HREF="page568.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7698" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0016420000000000000000">All-Pairs Source Shortest Path</A></H2><P>In this section we consider the <em>all-pairs, shortest path</em> problem:Given an edge-weighted graph <IMG WIDTH=73 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70549" SRC="img2166.gif" >,for each pair of vertices in <IMG WIDTH=11 HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline70551" SRC="img2167.gif" >find the <em>length</em> of the shortest weighted path between the two vertices.<P>One way to solve this problem is to run Dijkstra's algorithm <IMG WIDTH=18 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70975" SRC="img2249.gif" > timesin turn using each vertex in <IMG WIDTH=11 HEIGHT=12 ALIGN=BOTTOM ALT="tex2html_wrap_inline70551" SRC="img2167.gif" > as the initial vertex.Therefore, we can solve the all-pairs problem in <IMG WIDTH=152 HEIGHT=28 ALIGN=MIDDLE ALT="tex2html_wrap_inline71865" SRC="img2376.gif" >time when adjacency lists are used, and <IMG WIDTH=153 HEIGHT=28 ALIGN=MIDDLE ALT="tex2html_wrap_inline71867" SRC="img2377.gif" >,when adjacency matrices are used.However, for a dense graph ( <IMG WIDTH=89 HEIGHT=28 ALIGN=MIDDLE ALT="tex2html_wrap_inline70949" SRC="img2246.gif" >) the running timeof Dijkstra's algorithm is <IMG WIDTH=96 HEIGHT=28 ALIGN=MIDDLE ALT="tex2html_wrap_inline71871" SRC="img2378.gif" >,regardless of the representation scheme used.<P><BR> <HR><UL> <LI> <A NAME="tex2html7699" HREF="page570.html#SECTION0016421000000000000000">Floyd's Algorithm</A><LI> <A NAME="tex2html7700" HREF="page571.html#SECTION0016422000000000000000">Implementation</A><LI> <A NAME="tex2html7701" HREF="page572.html#SECTION0016423000000000000000">Running Time Analysis</A></UL><HR><A NAME="tex2html7696" HREF="page570.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7694" HREF="page563.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7690" HREF="page568.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7698" 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 + -
显示快捷键?