Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2012:journals:virginia:chapter3 [2012/01/30 02:19] – [Section 4: Testing Bipartiteness: An Application of BFS] lovellv | courses:cs211:winter2012:journals:virginia:chapter3 [2012/02/16 03:06] (current) – lovellv | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ===== Section 1: Basic Definitions and Applications ===== | ===== Section 1: Basic Definitions and Applications ===== | ||
| - | A //graph// consists of a collection of nodes (V) and edges (E). | + | A **graph** consists of a collection of nodes (V) and edges (E). |
| - | A //path// in a graph is a sequence of nodes where each consecutive pair is connected by an edge. A path is //simple// if all the vertices are distinct. | + | A **path** in a graph is a sequence of nodes where each consecutive pair is connected by an edge. A path is **simple** if all the vertices are distinct. |
| - | A graph is a //tree// if it is connected and does not contain a cycle. | + | A graph is a **tree** if it is connected and does not contain a cycle. |
| Theorem: Any two of the following imply the third (i) G is connected, (ii) G does not contain a cycle, (iii) G has n-1 edges | Theorem: Any two of the following imply the third (i) G is connected, (ii) G does not contain a cycle, (iii) G has n-1 edges | ||
| Line 46: | Line 46: | ||
| ===== Section 5: Connectivity in Directed Graphs ===== | ===== Section 5: Connectivity in Directed Graphs ===== | ||
| + | In this section, we begin to consider directed graphs. | ||
| + | BFS and DFS are almost the same as in undirected graphs. | ||
| + | |||
| + | The **strong component** containing s in a directed graph is the set of all v such that s and v are mutually reachable. | ||
| + | |||
| + | Readability: | ||
| + | |||
| + | ===== Section 6: Directed Acyclic Graphs and Topological Orderings ===== | ||
| + | |||
| + | A special type of directed graph that contains no cycles is a **directed acyclic graph** (DAG). | ||
| + | |||
| + | In fact, every DAG does have a topological ordering. We can find it by finding a node with no incoming edges, ordering it next in our topological ordering, deleting it from our graph, and repeating until we have added every node. This algorithm has O(m+n) run time. (p 103) | ||
| + | |||
| + | Readability: | ||
| + | |||
