{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture23 - Airline routes Admin PQueue due Pathnder out...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Admin PQueue due, Pathfinder out Joy poll Today’s topics Graphs and graph algorithms Reading Ch 11 hashing (next) Lecture #23 Airline routes Word ladders Course prerequisites
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Flowcharts Propose Flirt shamelessly Flirt aimlessly Trombone serenade Date Be single & love it 2-phase commit Get married Have baby! Have two, they're small! Mazes Social networks Graphs Another recursive data structure Node with any number of pointers to other nodes No restrictions on connectivity (allows disconnected, multiple paths, cycles) Terminology Node, arc, directed, connected, path, cycle B E C A D F
Background image of page 2
Implementation strategies Set of all arcs {a->b, a->c, b->d, c->d, d->a, d->b} Adjacency list a: {b, c} b: {d} c: {d} d: {a, b} Adjacency matrix Consider: sparse vs dense, space vs time a b c d a b c d x x x x x x B C A D Representing graphs in C++ struct nodeT { // data for node goes here Vector<nodeT *> connected; // or Set }; Graph itself is Set/Vector of node * Why not just pointer to root, like tree?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}