Table of Contents

Chapter 3

3.1 Basic Definitions and Applications

Graph Examples:

Paths and Connectivity:

Trees:


Personal Thoughts

This section was pretty simple, as it reviewed past concepts that were taught in multiple other classes. I like to have examples for applications of the various structures, so I appreciated the graph examples listed in this section. I think this section set a good foundation for working with graphs and trees. Readability: 10 Interesting: 8

3.2 Basic Definitions and Applications

Breadth-First Search

 BFS Execution:
   - Starting from node 1, Layer L<sub>1</sub> consists of the nodes {2,3}
   - Layer L<sub>2</sub> is then grown by considering the nodes in layer L<sub>1</sub> in order.For each node, the incident edges are examined. If an edge connects to a node that has already been discovered, it isn't added to the BFS.
   - Consider the nodes in the next layer in order. 
   - When no new nodes are left to be discovered, the algorithm terminates. 

Exploring a Connected Component

Depth-First Search

Similarities and Differences between DFS and BFS

  1. Both build connected components containing s
  2. Both create a natural rooted tree T on the component containing s
  3. DFS typically visits the same set of nodes in a different order than BFS
  4. DFS probes down long paths unlike, so the tree will have a very different structure than one from BFS
  5. DFS tree is narrow and deep; BFS tree is short and bushy

The Set of All Connected Components

Personal Thoughts

Like the previous section, this section was pretty simple, as it reviewed past concepts that were taught in multiple other classes. This section provided good reference material for BFS and DFS. It contained nothing to confusing and was review. Readability: 8.5 Interesting: 7

3.3 Implementing Graph Traversal Using Queues and Stacks

Representing Graphs

There are two basic ways to represent graphs:

  1. Adjacency Matrix: nXn matrix
  2. Adjacency List

Advantages and disadvantages of Adjacency Matrix vs. List

  1. The adjacency matrix representation of a graph requires O(n²) space, while the adjacency list representation requires only O(m+n) space.
  2. Matrix: allows O(1) time to check if a given edge exists in the graph, but representation takes O(n²) space and checking for edges takes considerable O(n) time
  3. List: works better for sparse graphs, there is an array containing a list of all nodes adjacent to node v, requires O(m+n) space, length of all lists in 2m → O(m)

Queues and Stacks

Implementing Breadth-First Search

Implementing Depth-First Search

Finding the Set of All Connected Components

Personal Thoughts

This section was not intuitive for me, but made a lot of sense as I was reading. Being familiar with BST, DST, queues, and stacks already, helped make this section easier to understand. The algorithms do take some time to conceptually understand, but are not that difficult. Readability: 8 Interesting: 6.5

Designing the Algorithm

Analyzing the Algorithm

Personal Thoughts

I don't really remember bipartite graphs from other classes, but they are pretty simple and this section made them very simple. We did already talk about them in class, so that did help as well. There wasn't any information that was too confusing in this short section. Readability: 10 Interesting: 8

3.5 Connectivity in Directed Graphs

Representing Directed Graphs

The Graph Search Algorithms

Strong Connectivity

Personal Thoughts

Again, this section was not very difficult to understand and most of it makes sense. I would like to talk a little bit more about strong connectivity in class. The concept makes sense, but I would like to learn more about why it is useful/important. It seems like O(m+n) is a very common running time for graphs… Readability: 9 Interesting: 7

3.6 Directed Acyclic Graphs and Topological Ordering

The Problem

Designing and Analyzing the Algorithm

Personal Thoughts

This section contained information that I had not yet been exposed to. However, most of the section was very intuitive. Cycles are not a very difficult concept so it makes sense why a DAG cannot have a cycle. This is my first time, as far as I remember, being exposed to DAGs, so it will be interesting to see how difficult I find them as we do more complex things with them. Readability: 9 Interesting: 8