Discrete Mathematics
Total Page:16
File Type:pdf, Size:1020Kb
Discrete Mathematics (c) Marcin Sydow Graph Vertex Discrete Mathematics Degree Graphs Isomorphism Graph Matrices Graph as (c) Marcin Sydow Relation Paths and Cycles Connectedness Trees Contents Discrete Mathematics Introduction (c) Marcin Sydow Graph Digraph (directed graph) Graph Vertex Degree of a vertex Degree Graph isomorphism Isomorphism Graph Adjacency and Incidence Matrices Matrices Graphs vs Relations Graph as Relation Path and Cycle Paths and Cycles Connectedness Connectedness Weakly and strongly connected components Trees Tree Rooted tree Binary tree Introduction Discrete Mathematics (c) Marcin Sydow Graph The role of graphs: Vertex Degree extremely important in computer science and mathematics Isomorphism numerous important applications Graph Matrices modeling the concept of binary relation Graph as Graphs are extensively and intuitively to convey information in Relation visual form. Paths and Cycles Here we introduce basic mathematical view on graphs. Connectedness Trees Graph (the mathematical definition) Discrete Mathematics (c) Marcin Sydow Graph (undirected graph) is an ordered pair of sets: Graph G = (V ; E), where: Vertex Degree 1 Isomorphism V is the vertex set Graph E is the edge set Matrices Graph as each edge e = fv; wg in E is an unordered pair of Relation vertices from V , called the ends of the edge e. Paths and Cycles Connectedness Vertex can be also called node. Trees 1plural form: vertices Edges and vertices Discrete Mathematics (c) Marcin Sydow For an edge e = fv; wg 2 E we say: Graph the edge e connects the vertices v i w Vertex Degree the vertices v and w are neighbours or are adjacent in the Isomorphism graph G Graph Matrices the edge e is incident to the vertex v (or w). Graph as Relation a self-loop is an edge of the form (v; v). Paths and Cycles If V and E are empty G is the zero graph, if E is empty it is an Connectedness empty graph Trees Directed graph (digraph) (mathematical definition) Discrete Mathematics (c) Marcin Sydow Directed graph (digraph) is an ordered pair: G = (V ; E), Graph where: Vertex Degree V is the vertex set Isomorphism Graph E is the edge set (or arc set) Matrices Graph as each edge e = (v; w) in E is an ordered pair of vertices Relation from V , called the tail and head end of the edge e, Paths and Cycles respectively. Connectedness Example Trees Simple graphs, multigraphs and hypergraphs Discrete Mathematics (c) Marcin Sydow Graph Simple graph: a graph where there are no self-loops (edges or Vertex Degree arcs of the form (v; v)). Isomorphism If there are possible multiple edges or arcs between the same Graph Matrices pair of vertices we call it a multi-graph. Graph as Relation Notice: in a directed graph (v; w) is a different arc than (w; v) Paths and for v 6= w. Cycles Connectedness Trees Picture of a graph Discrete Mathematics (c) Marcin Sydow Graph A given graph can be depicted on a plane (or other Vertex Degree 2-dimensional surface) in multiple ways (example). Isomorphism A picture is only a visual form of representation of a graph. Graph Matrices It is necessary to distinguish between an abstract Graph as Relation (mathematical) concept of a graph and its picture (visual Paths and representation) Cycles Connectedness Trees Degree of a vertex Discrete Mathematics (c) Marcin Sydow Graph Degree of a vertex v denoted as deg(v) is the number of edges Vertex Degree (or arcs) incident with this vertex. Isomorphism (note: we assume that each self-loop (v; v) contributes 2 to the Graph Matrices degree of the vertex v) Graph as Relation If deg(v) = 0 we call it an isolated vertex. Paths and Example Cycles Connectedness Trees Proof: each edge contributes 2 to the sum of degrees. Corollary: sum of degrees is twice the number of edges Corollary: the number of vertices with odd degree must be even. Example Degree sum theorem (hand-shake theorem) Discrete Mathematics (c) Marcin Sydow The sum of degrees of all vertices in any graph is always even. Graph Vertex (why?) Degree Isomorphism Graph Matrices Graph as Relation Paths and Cycles Connectedness Trees Degree sum theorem (hand-shake theorem) Discrete Mathematics (c) Marcin Sydow The sum of degrees of all vertices in any graph is always even. Graph Vertex (why?) Degree Isomorphism Proof: each edge contributes 2 to the sum of degrees. Graph Matrices Corollary: sum of degrees is twice the number of edges Graph as Relation Corollary: the number of vertices with odd degree must be Paths and even. Cycles Connectedness Example Trees Degrees in directed graphs Discrete Mathematics (c) Marcin Sydow Graph Vertex In directed graphs: indegree of a vertex v (indeg(v)): number Degree of arcs that v is the head of Isomorphism Graph outdegree of a vertex v (outdeg(v)): number of arcs that v is Matrices the tail of Graph as Relation Example Paths and Cycles Connectedness Trees Degree sum theorem for digraphs Discrete Mathematics (c) Marcin Sydow Graph The sum of indegrees of all vertices is equal to the sum of Vertex Degree outdegrees of all vertices in any directed graph. Isomorphism Proof: each arc contributes 1 to the indegree sum and 1 to the Graph Matrices outdegree sum. Graph as Relation Corollary: sum of indegrees (outdegrees) is equal to the number Paths and of arcs in a digraph. Cycles Connectedness Trees Graph Isomorphism Discrete Mathematics (c) Marcin Sydow Two graphs G1(V1; E1), G2(V2; E2) are isomorphic , there exists a bijection f : V1 ! V2 so that: Graph Vertex v; w are connected by an edge (arc) in G1 , Degree f (v); f (w) are connected by an edge (arc) in G2. Isomorphism Graph The function f is called isomorphism between graphs G and Matrices 1 Graph as G2. Relation Example Paths and Cycles Interpretation: graphs are isomorphic if they are “the same” Connectedness from the point of view of the graph theory (they can have Trees different names of vertices or be differently depicted, etc.). Subgraph and induced graph Discrete Mathematics (c) Marcin Sydow Subgraph of graph G = (V ; E) is a graph H = (V 0; E 0) so that Graph V 0 ⊆ V and E 0 ⊆ E and any edge from E 0 has both its ends in Vertex 0 Degree V . Isomorphism Example Graph Matrices A subgraph of G induced by a set of vertices V 0 ⊆ V is a Graph as 0 0 Relation subgraph G of G whose vertex set is V whose edges (arcs) are 0 Paths and all edges (arcs) of G that have both ends in V . Cycles Connectedness Example Trees empty graph Nn (n vertices, no edges) (example) full graph Kn (a simple graph of n vertices and all possible edges (arcs)) (example) bi-partite graph (its set of vertices can be divided into two disjoint sets so that any edges (arcs) are only between the sets) (example) full bi-partite graph Km;n (a bipartite graph that has all possible edges (arcs)) path graph Pn (example) cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow Graph Vertex Degree Isomorphism Graph Matrices Graph as Relation Paths and Cycles Connectedness Trees full graph Kn (a simple graph of n vertices and all possible edges (arcs)) (example) bi-partite graph (its set of vertices can be divided into two disjoint sets so that any edges (arcs) are only between the sets) (example) full bi-partite graph Km;n (a bipartite graph that has all possible edges (arcs)) path graph Pn (example) cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow empty graph Nn (n vertices, no edges) (example) Graph Vertex Degree Isomorphism Graph Matrices Graph as Relation Paths and Cycles Connectedness Trees bi-partite graph (its set of vertices can be divided into two disjoint sets so that any edges (arcs) are only between the sets) (example) full bi-partite graph Km;n (a bipartite graph that has all possible edges (arcs)) path graph Pn (example) cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow empty graph Nn (n vertices, no edges) (example) Graph full graph Kn (a simple graph of n vertices and all possible Vertex Degree edges (arcs)) (example) Isomorphism Graph Matrices Graph as Relation Paths and Cycles Connectedness Trees full bi-partite graph Km;n (a bipartite graph that has all possible edges (arcs)) path graph Pn (example) cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow empty graph Nn (n vertices, no edges) (example) Graph full graph Kn (a simple graph of n vertices and all possible Vertex Degree edges (arcs)) (example) Isomorphism bi-partite graph (its set of vertices can be divided into two Graph Matrices disjoint sets so that any edges (arcs) are only between the Graph as sets) (example) Relation Paths and Cycles Connectedness Trees path graph Pn (example) cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow empty graph Nn (n vertices, no edges) (example) Graph full graph Kn (a simple graph of n vertices and all possible Vertex Degree edges (arcs)) (example) Isomorphism bi-partite graph (its set of vertices can be divided into two Graph Matrices disjoint sets so that any edges (arcs) are only between the Graph as sets) (example) Relation Paths and full bi-partite graph Km;n (a bipartite graph that has all Cycles possible edges (arcs)) Connectedness Trees cyclic graph Cn (example) Some important graph families Discrete Mathematics (c) Marcin (all graphs below are simple graphs) Sydow empty graph Nn (n vertices, no