⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page539.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>Accessors and Mutators</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="tex2html7363" HREF="page540.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7361" HREF="page532.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7355" HREF="page538.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7365" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H2><A NAME="SECTION0016250000000000000000">Accessors and Mutators</A></H2><P>Program&nbsp;<A HREF="page539.html#proggraphc"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> continues the definition ofthe abstract <tt>Graph</tt> class.The following additional methods are defined in Program&nbsp;<A HREF="page539.html#proggraphc"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>:<P><DL ><DT><STRONG><tt>addVertex</tt></STRONG><DD>	This method inserts a vertex into a graph.	All the vertices contained in a given graph must have	a unique vertex number.	Furthermore, if a graph contains <I>n</I> vertices,	those vertices shall be numbered 0, 1, ..., <I>n</I>-1.	Therefore, the next vertex inserted into the graph shall	have the number <I>n</I>.    <DT><STRONG><tt>getVertex</tt></STRONG><DD>	In addition to <tt>self</tt>,	this method takes an integer, say <I>i</I> where  <IMG WIDTH=65 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline62043" SRC="img895.gif"  >,	and returns the  <IMG WIDTH=17 HEIGHT=14 ALIGN=BOTTOM ALT="tex2html_wrap_inline57847" SRC="img77.gif"  > vertex contained in the graph.    <DT><STRONG><tt>addEdge</tt></STRONG><DD>	This method inserts an edge into a graph.	If the graph contains <I>n</I> vertices,	both arguments must fall in the interval [0,<I>n</I>-1].    <DT><STRONG><tt>isEdge</tt></STRONG><DD>	In addition to <tt>self</tt>,	this <tt>bool</tt>-valued method takes two integer arguments.	It returns <tt>True</tt> if the graph contains an edge	that connects the corresponding vertices.    <DT><STRONG><tt>getEdge</tt></STRONG><DD>	In addition to <tt>self</tt>,	this method takes two integer arguments.	It returns the edge instance (if it exists)	that connects the corresponding vertices.	The behavior of this method is undefined when the edge	does not exist.	(An implementation will typically throw an exception).    <DT><STRONG><tt>getEmanatingEdges</tt></STRONG><DD>	In addition to <tt>self</tt>,	this method takes an integer argument	that specifies a vertex and returns and	iterator that enumerates the edges incident upon the specified vertex.    <DT><STRONG><tt>getIncidentEdges</tt></STRONG><DD>	In addition to <tt>self</tt>,	this method takes an integer argument	that specifies a vertex and returns and	iterator that enumerates the edges emanating from the specified vertex.    <DT><STRONG><tt>__len__</tt></STRONG><DD>	This method returns the number of vertices in the graph.    <DT><STRONG><tt>__getitem__</tt></STRONG><DD>	This method is equivalent to the <tt>getVertex</tt> described above.<P> </DL><P><P><A NAME="49990">&#160;</A><A NAME="proggraphc">&#160;</A> <IMG WIDTH=575 HEIGHT=695 ALIGN=BOTTOM ALT="program49688" SRC="img2269.gif"  ><BR><STRONG>Program:</STRONG> Abstract <tt>Graph</tt> class accessors and mutators.<BR><P><BR> <HR><UL> <LI> <A NAME="tex2html7366" HREF="page540.html#SECTION0016251000000000000000">Graph Traversals</A></UL><HR><A NAME="tex2html7363" HREF="page540.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7361" HREF="page532.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7355" HREF="page538.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html7365" 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -