This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Algorithms in Systems Engineering IE170 Lecture 14 Dr. Ted Ralphs IE170 Lecture 14 1 References for Today’s Lecture • Required reading – CLRS Chapter 22 • References – R. Sedgewick, Algorithms in C++ (Third Edition), 1998. IE170 Lecture 14 2 Operations on Graphs • Last lecture, we saw an algorithm that could be used to analyze the connectivity of a graph without actually storing the graph. • In discarding the list of edges, we lose a great deal of information about the structure of the graph. • In many cases, we need to make use of that information to perform other operations. • What are the basic operations we might want to perform on a graph if we could store it somehow? IE170 Lecture 14 3 Graph Interface Class class Graph{ private: // Implementation dependent code public: Graph(int); ~Graph(); int V() const; int E() const; int insert(Edge e); int delete(Edge e); bool edge(int v, int w) const; Vertex* getFirst(int i); }; IE170 Lecture 14 4 Vertex and Edge Classes class Edge{ public: Edge(int i, int j): v(i), w(j) {} ~Edge(); int v, w; }; class Vertex{ private: // Imlementation dependend code public: int getIndex() const; Vertex const * getNext() const; } IE170 Lecture 14 5 A Client Function for Printing a Graph • Here’s an example of a standard way in which the graph interface class is used....
View
Full Document
 Spring '07
 Ralphs
 Graph Theory, Systems Engineering, Adjacency list

Click to edit the document details