18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

War Story: Getting the Graph<br />

Next: Traversing a Graph Up: Graph <strong>Algorithm</strong>s Previous: Data Structures for Graphs<br />

War Story: Getting the Graph<br />

``It takes five minutes just to read the data. We will never have time to make it do something<br />

interesting.''<br />

<strong>The</strong> young graduate student was bright and eager, but green to the power of data structures. She would<br />

soon come to appreciate the power.<br />

Figure: <strong>The</strong> dual graph (dashed lines) of a triangulation<br />

As described in a previous war story (see Section ), we were experimenting with algorithms for<br />

extracting triangular strips for the fast rendering of triangulated surfaces. <strong>The</strong> task of finding a small<br />

number of strips that cover each triangle in a mesh could be modeled as a graph problem, where the<br />

graph has a vertex for every triangle of the mesh, and there is an edge between every pair of vertices<br />

representing adjacent triangles. This dual graph representation of the planar subdivision representing the<br />

triangulation (see Figure ) captures all the information about the triangulation needed to partition it<br />

into triangle strips.<br />

<strong>The</strong> first step in crafting a program that constructs a good set of strips was to build the dual graph of the<br />

triangulation. This I sent the student off to do. A few days later, she came back and announced that it<br />

took over five CPU minutes just to construct this dual graph of an object with a few thousand triangles.<br />

``Nonsense!'' I proclaimed. ``You must be doing something very wasteful in building the graph. What<br />

format is the data in?''<br />

file:///E|/BOOK/BOOK2/NODE62.HTM (1 of 3) [19/1/2003 1:29:05]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!