📄 page584.html
字号:
<HTML><HEAD><TITLE>Projects</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="tex2html7858" HREF="page585.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7856" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7852" HREF="page583.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7860" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H1><A NAME="SECTION0016800000000000000000">Projects</A></H1><P><OL><LI> <A NAME="projectgraphsi"> </A> Devise a graph description language. Implement a method that reads the description of a graph and constructs a graph object instance. Your method should be completely generic--it should not depend on the graph implementation used.<LI> <A NAME="projectgraphsii"> </A> Extend Project <A HREF="page584.html#projectgraphsi"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by writing a method that prints the description of a given graph object instance.<LI> <A NAME="projectgraphsmatrix"> </A> Complete the implementation of the <tt>GraphAsMatrix</tt> class introduced in Program <A HREF="page543.html#proggraphAsMatrixa"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> by providing suitable definitions for the following operations: <tt>__init__</tt>, <tt>purge</tt>, <tt>addVertex</tt>, <tt>getVertex</tt>, <tt>addEdge</tt>, <tt>getEdge</tt>, <tt>isEdge</tt>, <tt>vertices</tt>, <tt>edges</tt>, <tt>getIncidentEdges</tt>, and <tt>getEmanatingEdges</tt>. Write a test program and test your implementation.<LI> <A NAME="projectgraphslists"> </A> Repeat Project <A HREF="page584.html#projectgraphsmatrix"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> for the <tt>GraphAsLists</tt> class.<LI> <A NAME="projectgraphsdimat"> </A> The <tt>DigraphAsMatrix</tt> class can be implemented by extending the <tt>GraphAsMatrix</tt> class introduced in Program <A HREF="page543.html#proggraphAsMatrixa"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> and the abstract <tt>Digraph</tt> class introduced in Program <A HREF="page541.html#progdigrapha"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>:<PRE>class DigraphAsMatrix(GraphAsMatrix, Digraph): # ...</PRE> Implement the <tt>DigraphAsMatrix</tt> class by providing suitable definitions for the following methods: <tt>__init__</tt>, <tt>purge</tt>, <tt>addEdge</tt>, <tt>getEdge</tt>, <tt>isEdge</tt>, <tt>vertices</tt> and <tt>edges</tt>. You must also have a complete implementation of the base class <tt>GraphAsMatrix</tt> (see Project <A HREF="page584.html#projectgraphsmatrix"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>). Write a test program and test your implementation.<LI> Repeat Project <A HREF="page584.html#projectgraphsdimat"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> for the <tt>DigraphAsLists</tt> class.<LI> Add a method to the <tt>Digraph</tt> interface that returns the undirected graph which underlies the given digraph. Write an implementation of this method for the abstract <tt>Graph</tt> class introduced in Program <A HREF="page537.html#proggrapha"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<LI> Devise an approach using an enumerator and a stack to perform a topological-order traversal by doing a postorder depth-first traversal in reverse.<LI> The single-source shortest path problem on a DAG can be solved by visiting the vertices in topological order. Write an visitor for use with the <tt>topologicalOrderTraversal</tt> method that solves the single-source shortest path problem on a DAG.<LI> <A NAME="projectgraphsxform"> </A> Devise and implement an method that transforms a vertex-weighted <em>activity-node graph</em> into an edge-weighted <em>event-node graph</em>.<LI> Complete the implementation of the critical path analysis methods. In particular, you must implement the <tt>LatestTimeVisitor</tt> along the lines of the <tt>EarliestTimeVisitor</tt> defined in Program <A HREF="page582.html#progalgorithmsi"><IMG ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.</OL><P><HR><A NAME="tex2html7858" HREF="page585.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html7856" HREF="page519.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html7852" HREF="page583.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A> <A NAME="tex2html7860" 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 + -