Recitation 13: Relations and Directed Graphs
Part 1: Relations
- Consider the set of students
- and the set of colors
- Say that Jim is wearing a Red shirt, John is wearing a Black shirt, Mary is wearing a Purple shirt and Beth is wearing a Red shirt. Let be the relation between the students and the color of shirt they are wearing.
- What would the matrix representation of be?
- Is R transitive? What are some examples of transitive relations?
Part 2: Directed Graphs
- Use this website to create images of graphs online.
- Given this matrix representation, what would the directed graph look like?
The code for this graph is:
digraph G {
a -> b
b -> c
b -> e
e -> f
f -> a
c -> d
c -> g
e -> g
e -> h
f -> h
}
- Given this graph, what would the matrix representation be?
- What is the in-degree and out-degree of ?
- What is the longest cycle in this graph?
- Draw , , and the transitive closure of this graph.