page532.html

来自「Data Structures And Algorithms With Obje」· HTML 代码 · 共 43 行

HTML
43
字号
<HTML><HEAD><TITLE>Implementing Graphs</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="tex2html7280" HREF="page533.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7278" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7272" HREF="page531.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7282" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION0016200000000000000000">Implementing Graphs</A></H1><P>In keeping with the design framework used throughout this text,we view graphs as specialized containers.Formally, the graph  <IMG WIDTH=73 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline70549" SRC="img2166.gif"  > is an ordered paircomprised of two sets--a set of vertices and a set of edges.Informally, we can view a graph as a container with two compartments,one which holds vertices and one which holds edges.There are four kinds of objects--vertices, edges, undirected graphs, and directed graphs.Accordingly, we define four abstract classes:<tt>Vertex</tt>, <tt>Edge</tt>, <tt>Graph</tt>, and <tt>Digraph</tt>.(See Figure&nbsp;<A HREF="page532.html#figclasses9"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>).<P><P><A NAME="49442">&#160;</A><A NAME="figclasses9">&#160;</A> <IMG WIDTH=575 HEIGHT=430 ALIGN=BOTTOM ALT="figure49438" SRC="img2256.gif"  ><BR><STRONG>Figure:</STRONG> Object class hierarchy<BR><P><BR> <HR><UL> <LI> <A NAME="tex2html7283" HREF="page533.html#SECTION0016210000000000000000">Vertices</A><LI> <A NAME="tex2html7284" HREF="page535.html#SECTION0016220000000000000000">Edges</A><LI> <A NAME="tex2html7285" HREF="page536.html#SECTION0016230000000000000000">Graphs and Digraphs</A><LI> <A NAME="tex2html7286" HREF="page537.html#SECTION0016240000000000000000">Abstract Graphs</A><LI> <A NAME="tex2html7287" HREF="page539.html#SECTION0016250000000000000000">Accessors and Mutators</A><LI> <A NAME="tex2html7288" HREF="page541.html#SECTION0016260000000000000000">Directed Graphs</A><LI> <A NAME="tex2html7289" HREF="page542.html#SECTION0016270000000000000000">Implementing Undirected Graphs</A><LI> <A NAME="tex2html7290" HREF="page545.html#SECTION0016280000000000000000">Comparison of Graph Representations</A></UL><HR><A NAME="tex2html7280" HREF="page533.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7278" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7272" HREF="page531.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7282" 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 &#169; 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 + -
显示快捷键?