notes63 - if e is not explored: if vertex w is unexplored:...

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

View Full Document Right Arrow Icon
Trie (11.3, p. 550) example: trie tree for fast reTRIEval of strings rules all nodes except root store a character path from root to leaf encodes a string nodes are sorted lexically performance lookup is potentially O(n) for string of length n requires O(1) mapping from characters to child nodes (e.g. array lookup) slow to remove compressed trie: nodes can store strings example: compressed trie suffix trie: useful for pattern matching see Figure 11.10, p. 557 Graph (12.1, p. 577) consists of a set of vertices connected by a set of edges a tree is a special case of a graph terms adjacent vertices: connected by an edge degree of a vertex: number of adjacent verticers path: sequence of adjacent vertices simple path: no repeated vertices cycle: a simple path with a connection from end to start (A-B-C-A) connected graph: any 2 vertices are connected by some path Depth first search (12.3.1, p. 595) recursive traversal of a graph for each edge e(v,w) incidental to vertex v:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if e is not explored: if vertex w is unexplored: label e as a discovered edge DFS(w) else: label e as a back edge example black edges: discovered gray edges: back Directed Graph (digraph) (12.4, p. 611) a graph with directional edges one-way streets Makefile dependencies terms acyclic strongly connected: each vertex can reach all other vertices each strongly connected subgraph must be cyclic Transitive Closure (12.4.2, p. 615) denoted G* if there is a path A-B-C, add an edge AC computation DFS for each vertex v: for each vertex w in DFS(v): add (v,w) to G* Floyd-Warshall algorithm G* = G for k = 1 upto n for j = 1 upto n for i = 1 upto n if (i != j && j != k && i != k && (vi, vk) in G* G* += (vi, vj) comparably costly: O(n^3) Floyd-Warshall is easier to implement DFS only wins if the graph is sparse and represented w/ an adjacency list...
View Full Document

This note was uploaded on 02/02/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue University.

Page1 / 2

notes63 - if e is not explored: if vertex w is unexplored:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online