📄 page533.html
字号:
<HTML><HEAD><TITLE>Vertices</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="tex2html7299" HREF="page534.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7297" HREF="page532.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7291" HREF="page532.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7301" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0016210000000000000000">Vertices</A></H2><P>What exactly is a vertex?The answer to this question depends on the application.At the very minimum,every vertex in a graph must be distinguishablefrom every other vertex in that graph.We can do this by numbering consecutively the vertices of a graph.In addition, some applications require vertex-weighted graphs.A weighted vertex can be viewed as one which carries a ``payload''.The payload is an object that represents the weight on the vertex.<P>Program <A HREF="page533.html#progvertexa"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> defines the <tt>Vertex</tt> class.The abstract <tt>Vertex</tt> class extendsthe abstract <tt>Object</tt> classintroduced in Program <A HREF="page116.html#progobjecta"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<P><P><A NAME="49939"> </A><A NAME="progvertexa"> </A> <IMG WIDTH=575 HEIGHT=661 ALIGN=BOTTOM ALT="program49451" SRC="img2257.gif" ><BR><STRONG>Program:</STRONG> Abstract <tt>Vertex</tt> class.<BR><P><P>Every vertex in a graph is assigned a unique number.The <tt>number</tt> property returns the number of a vertex.The <tt>weight</tt> property returns an object that representsthe weight associated with a weighted vertex.If the vertex is is unweighted,the <tt>weight</tt> property returns <tt>None</tt>.<P><BR> <HR><UL> <LI> <A NAME="tex2html7302" HREF="page534.html#SECTION0016211000000000000000">Iterators</A></UL><HR><A NAME="tex2html7299" HREF="page534.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7297" HREF="page532.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7291" HREF="page532.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7301" 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -