Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2018:journals:lesherr:home:chapter3 [2018/02/04 23:48] – [Section 4: Testing Bipartiteness: An Application of Breadth-First Search] lesherr | courses:cs211:winter2018:journals:lesherr:home:chapter3 [2018/02/05 00:19] (current) – [Section 6: Directed Acyclic Graphs and Topological Ordering] lesherr | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ===== Section 4: Testing Bipartiteness: | ===== Section 4: Testing Bipartiteness: | ||
| 'A bipartite graph is a graph where the node set can be partitioned into sets X and Y in such a way that ever edge has one end in X and the other end in Y.' A way to restate this is a graph that can have its nodes split into two colored groups where no node in one group has an edge to another node in that group. Every edge of the graph should have a node of one color on one end and a node of a different color on the other end. One characteristic of a bipartite graph is that it cannot contain an odd cycle. A BFS of an algorithm must have 1 of the following two characteristics: | 'A bipartite graph is a graph where the node set can be partitioned into sets X and Y in such a way that ever edge has one end in X and the other end in Y.' A way to restate this is a graph that can have its nodes split into two colored groups where no node in one group has an edge to another node in that group. Every edge of the graph should have a node of one color on one end and a node of a different color on the other end. One characteristic of a bipartite graph is that it cannot contain an odd cycle. A BFS of an algorithm must have 1 of the following two characteristics: | ||
| - | ===== Section 5 ===== | + | ===== Section 5: Connectivity in Directed Graphs |
| - | ===== Section 6 ===== | + | Previously, we have only been considering undirected graphs, where each edge has no particular orientation. In a directed graph, an edge does have direction and goes from one node u to a node v. 'The relationship between u and v is asymmetric, which changes the structure of the graph.' |
| - | + | ===== Section 6: Directed Acyclic Graphs and Topological Ordering | |
| + | 'If an undirected graph has no cycles, then it has an extremely simple structure: each of its connected components is a tree.' A directed graph with no cycles is called a directed acyclic graph (DAG). DAGs are very common in computer science, since lots of dependency structures are acyclic. DAGs are useful to encode precedence relations or dependencies in a natural way. Business position heirarchies can be represented very accurately with directed acyclic graphs (i.e. who reports to whom, who is the boss of who). A topological ordering of a graph is an ordering of nodes so that every edge points forward in the ordering from a node of lower numbering to a node of higher numbering. 'If a graph has a topological ordering, then G is a DAG.' 'In every DAG, there is a node with no incoming edges.' | ||
