The Graph Class
Terminologies
-
Graph - a pair of sets , where is the graph itself, is the vertex and is the edge set
- Vertex - a set of objects, each element is called a vertex of the graph, while the set itself is called the set of vertices of the graph [rep collection of points]
- Edge - a set of pairs of objects from , where each pair is a set of distinct vertices, called the edge of the graph () [rep relationships]
-
Order does not matter in the pairs, ()
-
Ex. Use the terminology of graphs to describe Facebook
- Each Facebook user is a vertex
- Each friendship between two Facebook users is an edge between the vertices.
-
Adjacent (neighbours) - if there exists a edge between two vertices
-
Let and and are neighbours iff
-
Degree of a vertex - the number of neighbours has
-
Path - sequences of distinct vertices that ”connects” the vertices and satisfies the these:
- Let and , and
- Each consecutive pair are adjacent ( are adjacent, are adjacent…)
- could be zero, in which the path is only a single vertex
-
Length of a path - one less than the number of vertices in the sequence
- The number of edges used by this path sequence
- Allow 0 length paths, a vertex is always connected to itself
-
Connected - when there exist a path between and (or )
-
A graph is connected when for all pairs of vertices , are connected
Ex. Proof that this graph is not connected
Poof. Let be the above graph, let be the vertices labelled respectively.
Want to show that there does not exist a path between , thus the graph is not connected
-
Since must be adjacent, and is the only vertex adjacent to , get that .
-
Now , get that
-
By definition of path, know that must be adjacent of (but not ). However, no such vertex exist. Therefore does not exist.
-
This proves the contradiction, in which shows that this graph does not exist
-
Properties of Graphs
-
Prove that about the maximum possible number of edges a graph follows an equation
- Translation:
- Proof Using induction on ,
- Base Case: Let , need to prove that
- Let be an arbitrary graph, assume that (the graph have no vertices).
- In this case, the graph is not able to have any edges. Therefore which satisfies
- Induction step: Let and assume that holds (every graph with vertices has at most ) edges.
- Let be an arbitrary graph, assume that want to show that .
- Let be a vertex in , divide the edges of into 2 groups
- - the set of edges that contain . There are at most other vertices in that could be adjacent to: .
- - the set of edges that do not contain . Suppose remove from the graph, get . Then is the set of edges in the new graph
- Putting them together get:
- This is exactly what I wanted to show
-
Prove if 2 vertices in a graph are both connected to a third vertex, then they are also connected to each other.
- Translation: Use the predicate for ” and are connected vertices in ”
- Proof: Let be a graph, and . Assume that are connected, and are connected, want to show that are connected
- Let be a path between and be a pth between . By definition, they exist
- Strategy: To avoid common vertices that is in both , find the first POV between , and join them at the vertex
- Let tbe the set of all vertices that are both in . This set would never be empty because at least
- Translation: Use the predicate for ” and are connected vertices in ”
- Let be the vertex in that is the closest vertex to in . Since in , then this means that it is also in .
- Finally, let be the path of vertices from to in , joined with vertices from to in . Therefore, the path is a valid path (no duplicates) and is indeed a path between
-
Prove that for all graphs , if then there exist 2 vertices in with the same degree
- Translation:
- Proof: Assume for a contradiction that this statement is False. Let , want to show:
- Let be an arbitrary vertex in . Know that . For potential neighbours of , there are possibilities, therefore, get . So this show that:
- Since there are different vertices in and each has a different degree. Then every element in the set in must be the degree associated with some vertex :
- (1) so this vertex is not adjacent to any other vertex:
- (2) , then it is adjacent to every other vertex, so
- Since both and are True, then the contradiction is true.