Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2014:journals:haley:chapter3 [2014/01/29 04:16] – archermcclellanh | courses:cs211:winter2014:journals:haley:chapter3 [2014/02/12 07:33] (current) – archermcclellanh | ||
|---|---|---|---|
| Line 44: | Line 44: | ||
| ===== 3.4: Testing Bipartiteness ===== | ===== 3.4: Testing Bipartiteness ===== | ||
| - | * | + | * Bipartite graphs contain no odd cycles. |
| + | * We can use breadth-first search to determine whether a graph is bipartite. We can then say: | ||
| + | * No edge of G joins two vertices of the same layer, thus G is bipartite and we can color the even layers one color and the odd another. | ||
| + | * xor | ||
| + | * An edge joins two vertices in the same layer, G contains an odd-length cycle, so G is not bipartite. | ||
| + | * This book section wasn't very interesting. 7/10. | ||
| + | |||
| + | ===== 3.5: Digraphs & Connectivity ===== | ||
| + | * We represent digraphs as two adjacency lists, one of which is all in-edges and one of which is all out-edges. | ||
| + | * BFS & DFS are essentially the same now, with the following changes: | ||
| + | * BFS is given by finding all vertices with in-edges from our starting vertex to any other vertex. | ||
| + | * DFS is given recursively from vertex //v// by finding a vertex with an edge //v → u//. | ||
| + | * A digraph is strongly connected if for every pair of vertices (u,v) there exist paths u → v and v → u. | ||
| + | * If two vertices u,v are mutually reachable and v,w are mutually reachable, then u,w are mutually reachable. | ||
| + | * The strongly connected components of two vertices in a digraph D are either disjoint or identical. | ||
| + | * Well-written and interesting and delightful. 10/10. | ||
| + | |||
| + | ===== 3.6: Directed Acyclic Graphs & Topological Orderings ===== | ||
| + | * A Directed Acyclic Graph is a directed graph without cycles. Go figure. | ||
| + | * They can be used to determine precedence relationships. | ||
| + | * A // | ||
| + | * Iff G is a DAG, it has a topological ordering. | ||
| + | * Every DAG necessarily has a vertex with no incoming edges. | ||
| + | * We compute topological orderings by finding a vertex in G without incoming edges, putting it first, and deleting it from G. Then recursively find a topo-ordering of G-v and appending that. | ||
| + | * This section was okay. 8/10. | ||
