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/01/28 03:21] – nollets | courses:cs211:winter2014:journals:shannon:chapter3 [2014/02/10 18:50] (current) – [3.6: Directed Acyclic Graphs and Topological Ordering] nollets | ||
---|---|---|---|
Line 29: | Line 29: | ||
I would give this section a 7/10 because although it was pretty easy to read, I still got a little jumbled up in the explanations. | I would give this section a 7/10 because although it was pretty easy to read, I still got a little jumbled up in the explanations. | ||
+ | |||
+ | =====3.4: Testing Bipartiteness: | ||
+ | |||
+ | A bipartite graph is a graph that has a node set V that can be partitioned into a set of red nodes and blue nodes so that every edge has one red node and one blue node. It can be found that if a graph has an odd cycle, then it is not bipartite and if a graph has no odd cycles then it is bipartite. The odd-length cycle is the only thing that prevents a graph from being bipartite. In order to tell if a graph is bipartite we can use a breadth-first search and we can assign each layer a color. Then if any edges have the same color we know that the graph is not bipartite. | ||
+ | |||
+ | The breadth-first search algorithm runs in O(n+m). | ||
+ | |||
+ | This was a pretty easy concept to understand (it might be the colors) and the section just outlined what we had discussed in class. | ||
+ | |||
+ | This section was pretty clear, quick, and easy to read. I would give it an 8/10. | ||
+ | |||
+ | =====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. 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. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||