Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
courses:cs211:winter2014:journals:shannon:chapter3 [2014/02/10 18:23] – [3.4: Testing Bipartiteness: An Application of Breadth-First Search] nollets | courses:cs211:winter2014:journals:shannon:chapter3 [2014/02/10 18:50] (current) – [3.6: Directed Acyclic Graphs and Topological Ordering] nollets | ||
---|---|---|---|
Line 42: | Line 42: | ||
=====3.5: Connectivity in Directed Graphs===== | =====3.5: Connectivity in Directed Graphs===== | ||
- | In a directed graph, edges have directions. Directed graphs can be represented by a list of nodes that each have two lists, one with the edges coming into it and another with the edges leaving it. In order to determine what the connected components are we can run either BFS or the DFS in the forwards direction and then in the backwards direction. A graph is strongly connected if for nodes u and v, there is a path from u to v and a path from v to u. Directed graphs also have a transitive property. That is, if u and v are mutually reachable and v and w are mutually reachable, then u and w are mutually reachable. Finally, for any two nodes, their strongly connected components are either disjoint or identical. | + | In a directed graph, edges have directions. Directed graphs can be represented by a list of nodes that each have two lists, one with the edges coming into it and another with the edges leaving it. In order to determine what the connected components are we can run either BFS or the DFS in the forwards direction and then in the backwards direction. A graph is strongly connected if for nodes u and v, there is a path from u to v and a path from v to u. Directed graphs also have a transitive property. That is, if u and v are mutually reachable and v and w are mutually reachable, then u and w are mutually reachable. Finally, for any two nodes, their strongly connected components are either disjoint or identical. This means that there cannot be a node t such that u and v are each strongly connected to t but not strongly connected to each other. |
The algorithms to find the strongly connected components run in O(n+m) time. | The algorithms to find the strongly connected components run in O(n+m) time. | ||
+ | |||
+ | I feel like a lot of the concepts in the graph sections are most easily explained by pictures. Such as the idea of a strongly connected component being either identical or disjoint. This is a pretty easy thing to draw out and see, but a little bit confusing to just think of as I was reading. Having the visual component in class is extremely helpful to internalize and understand. | ||
+ | |||
+ | I would give this section a 8/10. It was easy to understand and a helpful recap of directed graphs. I had gotten used to thinking of graphs as trees rather than graphs and the can be very different! | ||
+ | |||
+ | |||
+ | =====3.6: Directed Acyclic Graphs and Topological Ordering===== | ||
+ | |||
+ | A directed graph which contains no cycles is referred to as a directed acyclic graph or a DAG. DAGs are useful to represent dependencies, | ||
+ | |||
+ | I was a little confused on the O(n+m) run time. I mentioned this on my test, but I still get a little confused on how we determine whether to add or multiply runtimes. | ||
+ | |||
+ | I would give this section an 8/10. It was helpful and straightforward. The dependency concept is one I am comfortable and we definitely made a DAG similar to the one I described in the summary in 112. | ||
+ | |||
+ | |||