Graph theory: basic concepts

Similar documents
Graph Theory CS/Math231 Discrete Mathematics Spring2015

Varying Applications (examples)

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

Material handling and Transportation in Logistics. Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena

Introduction III. Graphs. Motivations I. Introduction IV

How can we lay cable at minimum cost to make every telephone reachable from every other? What is the fastest route between two given cities?

An Introduction to Graph Theory

Introduction to Mathematical Programming IE406. Lecture 16. Dr. Ted Ralphs

GRAPH THEORY AND LOGISTICS

Elements of Graph Theory

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Chapter 11: Graphs and Trees. March 23, 2008

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

Graph Theory. Part of Texas Counties.

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

8. The Postman Problems

Graph Theory. ICT Theory Excerpt from various sources by Robert Pergl

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees

Lecture 1: Examples, connectedness, paths and cycles

Graphs: Definitions Trails, Paths, and Circuits Matrix Representations Isomorphisms. 11. Graphs and Trees 1. Aaron Tan. 30 October 3 November 2017

Classic Graph Theory Problems

0.0.1 Network Analysis

CHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ - artale/z

Graphs Definitions. Gunnar Gotshalks. GraphDefinitions 1

Introduction to Engineering Systems, ESD.00. Networks. Lecturers: Professor Joseph Sussman Dr. Afreen Siddiqi TA: Regina Clewlow

Graph and Digraph Glossary

Chapter 2 Graphs. 2.1 Definition of Graphs

6 ROUTING PROBLEMS VEHICLE ROUTING PROBLEMS. Vehicle Routing Problem, VRP:

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Chapter 9 Graph Algorithms

Introduction to Graph Theory

6.2. Paths and Cycles

Graphs. Pseudograph: multiple edges and loops allowed

CHAPTER 10 GRAPHS AND TREES. Copyright Cengage Learning. All rights reserved.

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

8.2 Paths and Cycles

Chapter 9 Graph Algorithms

Math 776 Graph Theory Lecture Note 1 Basic concepts

Vertex-Edge Graphs. Vertex-Edge Graphs In the Georgia Performance Standards. Sarah Holliday Southern Polytechnic State University

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

Chapter 9 Graph Algorithms

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

CS 4407 Algorithms Lecture 5: Graphs an Introduction

Graphs and Genetics. Outline. Computational Biology IST. Ana Teresa Freitas 2015/2016. Slides source: AED (MEEC/IST); Jones and Pevzner (book)

Introduction aux Systèmes Collaboratifs Multi-Agents

Introduction to Graphs. Tecniche di Programmazione A.A. 2017/2018

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

Algorithms. Graphs. Algorithms

Konigsberg Bridge Problem

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Chapter 1 Graph Theory

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Dieter Jungnickel (2008), Graphs, Networks and Algorithms, 3rd edition, which is available online via SpringerLink.

CMSC 380. Graph Terminology and Representation

BIL694-Lecture 1: Introduction to Graphs

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.

Discrete Mathematics

Ordinary Differential Equation (ODE)

Graphs. Introduction To Graphs: Exercises. Definitions:

Discrete mathematics II. - Graphs

Graph Overview (1A) Young Won Lim 5/9/18

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Network models and graph theory

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

Chapter 2: Graph Theory

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Introduction to Graphs

1 Digraphs. Definition 1

Graphs, graph algorithms (for image segmentation),... in progress

Chapter 3: Paths and Cycles

Simple graph Complete graph K 7. Non- connected graph

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

Figure 2.1: A bipartite graph.

Basics of Graph Theory

Combinatorics Summary Sheet for Exam 1 Material 2019

Foundations of Discrete Mathematics

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Network Topology and Graph

Worksheet for the Final Exam - Part I. Graphs

All 13,509 cities in US with a population of at least 500 Reference:

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

3 Euler Tours, Hamilton Cycles, and Their Applications

Graph (1A) Young Won Lim 4/19/18

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

Outline. 1 The matching problem. 2 The Chinese Postman Problem

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

2. CONNECTIVITY Connectivity

Fundamental Properties of Graphs

Number Theory and Graph Theory

Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks

Course Introduction / Review of Fundamentals of Graph Theory

Transcription:

Graph theory: basic concepts Graphs and networks allow modelling many different decision problems Graphs permit to represent relationships among different kinds of entities: Cities connected by roads Computers connected in a network People linked by family relationships Two persons sharing a room Connections among electronic components Graphs are a formal tool to model problems as Find the shortest path between two cities Determine the cheapest (most effectie) way of connecting a set of computers in a communication network Assign a set of jobs to a set of machines Find the routes for a fleet of ehicle to supply a set of customer in the most effectie way

Undirected graph An undirected graph G=(V, E) is defined by a pair of finite sets: V={ 1,..., n } set of n nodes (ertices) of G E={e 1,..,e m } V V set of m non directed arcs (edges) of G Each edge of G corresponds to an unordered pair of nodes of G e k =( i, j ) Nodes may be associated with entities and an edge denotes a relationship between two of them (e.g., two connected computers) Edges can represent roads, paths, physical connections (water or gas supply pipelines, electrical lines) and nodes can represent junction points (e.g., crossroads)

Example of undirected graph G =(V, E) 1 e 2 2 e 6 e 1 e 3 e 5 3 e 7 e 4 5 4 V = {,,, } E = { e, e, e, e, e, e e } 1 2 3 4, 5 (, ) e ( ) e = 1 = 1 5 2 1, 1 2 3 4 5 6, 2 7

Definitions An edge (,) is a loop Two nodes u, V are adjacent if it exists (u,) E u adjacent u not adjacent k k u h Not adjacent Two edges (u,),(,h) E are adjacent if they share a node An edge (u,) is defined by the pair of linked nodes A graph where more edges exist for a same pair of nodes is a multigraph u multigraph

Definitions (cont.) An edge connecting more than two nodes is an hyperedge Hyperedge (u,,k) u k In general a hyperedge is a subset of V Graphs including hyperedges are hypergraphs A graph without multiple edge, hyperedge and loop is a simple graph An edge f=(u,) E is incident on u and The node set N()={z V: z adjacent to } is the neighbourhood of in G u k s h N()={u,k,s,h}

Definitions (cont.) The set of edges δ()={e E: e incident on } is the star of in G u k e 1 e 2 δ() is the degree of node e 3 s h δ()={(u,),(k,),(,s),(,h)} or e 4 δ()={e 1, e 2, e 3, e 4 }

Subgraphs H=(W, F) is subgraph of G=(V,E) if W V and F E and such that if (u,) F then u, W 1 e 2 2 1 e 2 2 e 3 e 6 e 1 e 5 3 e 1 3 5 e 4 e 7 5 G=(V,E) 4 H=(W,F) subgraph of G

Subgraphs H=(W, F) is subgraph induced by W in G=(V, E) if W V and (u,) F implies that u, W and (u,) E 1 e 2 2 1 e 2 2 e 1 e 3 e 5 e 6 3 e 1 e 3 e 6 3 5 e 4 e 7 5 G=(V,E) 4 H=(W,F) subgraph of G induced by nodes in W

Subgraphs H=(W, F) is subgraph induced by F in G=(V,E) if (u,) F implies that (u,) E and u, W V 1 e 2 2 1 e 2 2 e 1 e 3 e 5 e 6 3 e 3 e 6 3 5 e 4 e 7 5 G=(V,E) 4 H=(W, F) subgraph of G induced by edge in F

Bipartite graph G=(V,E) is a bipartite graph if it exists a partition of V=V 1 V 2 such that: V 1 V 2 = e=(u,) E if u V 1 then V 2 otherwise if u V 2 then V 1 Bipartite graph V 1 V 2 Not Bipartite graph

Complete graph G=(V,E) is complete if it includes all possible edges, that is δ() =n-1 V where n= V Maximum number of edges for a non oriented complete graph n 2 = n( n 1) 2 Complete graph

Directed graph G=(V,A) directed graph is defined by a pair of finite sets: V={ 1,..., n } set of n nodes di G A={a 1,..,a m } V V set of m arcs of G where a j j=1,...,m is defined by an ordered pair of nodes In a directed graph a i =( k, h ) a j =( h, k ) a i, a j A 1 a 3 2 a1 a2 a 4 a 6 a 4 5 3

Directed graphs Arcs (directed links) are represented by arrows Tail u a Arc a=(u,) is incident on nodes u e : exiting from u and entering in Arcs are used when there is a direction in the relationship between nodes (e.g., one way road, direction of flow for a fluid) δ + ()={a A: a exiting from } set of arcs said forward star of δ - ()={a A: a entering in } set of arcs said backward star of Star of δ ()=δ + () δ - () δ + ()={(,s),(,h)} or δ + ()={a 3, a 4 } δ - ()={(u,),(k,)} or δ - ()={a 1, a 2 } u k a 1 a 2 Head a 3 a 4 s h

Directed graphs Definition of subgraph and induced subgraph are analogous to those for undirected graphs G=(V,A) directed graph is complete if it includes all the possible arcs, that is, δ + () = δ - () =n-1 V Maximum number of arcs for a directed complete graph n 2 = n( n 1) 2

Mixed graph G=(V,A E) is a mixed graph if the set of arcs includes both directed and undirected arcs Example: urban road networks are usually mixed graphs A complete (directed or undirected) graph is called clique Also complete subgraphs of a graph are denoted as cliques In a clique each node is adjacent to any other node in the clique Graph density: the ratio between the number of arcs and the maximum number of arcs m For undirected graphs D = n( n 1) / 2 0 D 1

Walks and Paths Gien an undirected graph G=(V, E) a walk in G is an ordered set of nodes W={ 0, 1,..., k } with k 1 ( 0 - k walk in G) if ( i 1, i ) E i=1,...,k Nodes 0 and k are the extremes of walk W Example W={ 0, 1, 2, 3, 4, 2 3, 4, 5 } 3 0 1 4 2 5

For directed G=(V, A) W={ 0, 1,..., k } with k 1 where ( i-1, i ) A i=1,...,k is an directed walk in G Length of W is the number of arcs in W Distance between two nodes u and is the minimum length of a walk from u to Example 1 a1 a2 a 3 a 4 2 a 6 a 5 4 3 W={ 1, 4, 3, 2 } walk W ={ 1, 4, 1, 4, 2, 3 } directed walk

Gien an undirected G=(V, E), simple walk or path in G, P={ 0, 1,..., k } is a walk such that all included nodes and arcs are distinct Example P={ 0, 1, 2, 3, 4, 5 } 3 0 1 4 2 5

For a directed G=(V, A), a directed path in G, P={ 0, 1,..., k } is a directed walk isiting its nodes only once Example 1 a1 a2 a 3 a 4 2 a 6 a 5 4 3 P={ 1, 4, 2, 3 } directed path An apparent property: If a (directed) walk between u and exists, then also a simple (directed) walk between u and exists

A walk W={ 0, 1,..., k, 0 } is said closed walk A simple closed walk is said cycle or circuit Example (closed walk) 6 1 5 4 3 2 Example (cycles) directed

Connected graphs and connected components Gien G=(V, E) a node V is connected to a node z V if a (undirected or directed) walk exist between and z in G Example: mixed graph where connected to z but not connected to h z walk z h A node V is connected to itself (reflectiity) If V is connected to z V then z is connected to (symmetry) If V is connected to z V and z is connected to u V then is connected to u (transitiity)

The set of node V can be partitioned according to the property of connectionin subsets C i C i ={ V: is connected to z, z C i } The sub-graph induced by C i in G is said connected component of G If G includes a single connected component it is a connected graph ( V, z Vis connected to z) Example Non connected graph Connected components Connected graph

In a directed graph G=(V, A), V is strongly connected to z V if two directed walks exist in G, the first from to z and the second from z to Strong connectiity extends connectiity taking into account the direction of arcs Example and z strongly connected z and z not strongly connected z A directed graph can be partitioned in strongly connected components, i.e., subsets C i C i ={ V: is strongly connected to z, z C i } In a strongly connected component, each node is connected to any other node by a directed walk

A graph is strongly connected if it includes a single strongly connected component Example Strongly connected components Strongly connected graph

Graph theory: trees Definition A graph is acyclic if it does not contain any (directed or undirected) cycle Example Acyclic Not acyclic Lemmas: Any connected graph with n nodes contains at least n-1 arcs Any acyclic graph with n nodes includes at most n-1 arcs For any graph if two among the following properties hold, then the third property is implied : The graph is acyclic The graph is connected The graph contains n-1 arcs

Graph theory: trees Definizione A tree is an acyclic connected graph Any node of a tree with δ() =1 is said leaf Example Leaes Non acyclic connected graph Tree

Graph theory: trees Definition A forest is a not connected acyclic graph (each connected component is a tree) Example Connected components = trees Not connected acyclic graph = forest

Graph theory: trees Gien G=(V, E) the following statements are equialent: G is a tree Any pair of nodes in G is connected by a unique path G is acyclic and E = V -1 G is acyclic and connecting two not adjacent nodes a single cycle is closed in the graph G is connected and E = V -1 The number of edges in a forest with k connected components is n-k If in a tree V =n 2 then at least two leaes exist A Spanning Tree (ST) of G=(V, E) is a tree T=(W,F) withw=v and F E, i.e., a sub-graph of G Example A spanning tree A ST always exists for connected graphs

Hamiltonian and Eulerian paths and cycles Defintion Gien G=(V, E) a Hamiltonian path is a path isiting all the nodes in V exactly once A Hamiltonian circuit (also called tour) is a closed Hamiltonian path A graph is said Hamiltonian if it includes a Hamiltonian circuit Example Hamiltonian path 2 3 4 Hamiltonian cycle 1 5

Hamiltonian and Eulerian paths and cycles Related problems: Determine if a graph includes a Hamiltonian path/cycle (hard problem) Gien a complete graph, whose arcs hae an associated length, determine the shortest Hamiltonian circuit: the well-known Traelling Salesman s Problem (TSP): A traelling salesman must isit n customers in n different cities starting and ending the tour at her/his city of residence In which sequence she/he must isit the customers if she/he wants to minimize the total distance coered?

Hamiltonian and Eulerian paths and cycles Problems associated with TSP Transportation problems: determine the best route for a ehicle or a fleet of ehicles in order to sere a demand located in a set of nodes of a graph representing a road network Many operational conditions: Capacity of ehicles and capacity required by demand Time windows (for arrial at nodes) Maximum tour duration (driers shifts) Pick-up and deliery serice Single or multiple depots Multiple ehicles with capacity = Vehicle Routing Problem (VRP) 10 11 1 9 4 6 0 Example of VRP solution 3 5 7 2 12 8

Hamiltonian and Eulerian paths and cycles Why a complete graph is assumed for TSP? For TSP (or VRP) the arcs of the graph do not represent a road network but the possibility to trael from one node to another (through a path) The graph is complete since such possibility in transportation is always true The cost/distance associated with each arc = shortest path between any pair of nodes distances (costs) i h 3 2 (not complete) road network k 2 1 j Shortest paths distances (costs) i h 3 2 3 k 2 1 Associated complete graph j

Hamiltonian and Eulerian paths and cycles Example: a scheduling problem that can be modelled as TSP Find the sequence for a set of manufacturing operations (jobs) on a machine so that it completes as soon as possible The processing times of the jobs are fixed A setup (e.g., cleaning) operation is needed between two successie jobs whose duration depends on the pair of jobs Example: a painting machine Blu painting setup Green painting Minimizing total duration = minimizing the total setup time Model: TSP on a complete graph Arc length = setup time

Hamiltonian and Eulerian paths and cycles Definition Gien G=(V, E) an Eulerian path is a path that isits all the arcs in E exactly once An Eulerian circuit is a closed Eulerian path A graph is Eulerian is it contains an Eulerian circuit Example 8 1 2 5 6 3 7 4

Hamiltonian and Eulerian paths and cycles The problem of finding an Eulerian path was defined by Euler in 1736 and presented at Saint Petersburg Academy as: In the city of Könisberg there is an island called Kneiphof around which flow the two branches of the Pregel Rier. There are seen bridges a, b, c, d, e, f, g which cross the two branches. The question is whether a person can choose a walk that leads to cross each bridge once but no more than once. Königsberg capital of Eastern Prussia Since the end of World War II Königsberg became Russian with the name of Kaliningrad

Hamiltonian and Eulerian paths and cycles A Pregel rier with its 7 bridges Pregel rier B C D A The model is a multigraph B C The problem: Is this graph Eulerian? D Euler found that there is no path with such property and deried the necessary and sufficient conditions for a undirected graph be Eulerian

Hamiltonian and Eulerian paths and cycles Theorem An undirected connected graph G=(V, E) is Eulerian if and only if eery node has een degree Theorem An undirected connected graph G=(V, E) contains an Eulerian path if eery node has een degree with the exception of two nodes s and t. Then the extremes of the Eulerian path are s and t. Exercise: which are the conditions for a directed graph to be Eulerian?

Hamiltonian and Eulerian paths and cycles The Chinese Postman Problem (CPP) CPP is the problem associated with Eulerian circuits as TSP is the one associated with Hamiltonian circuits : A postman has to delier mail to all the houses located on the streets of his neighbourhood. Its objectie is to complete its job coering the shortest distance, i.e., aoiding as much as possible to pass more than once along the same street. If the graph that model the map of the streets is Eulerian the postman does not need to pass more the once on each street Otherwise, the problem consists in finding how to complete the tour passing more then once only on the needed most conenient streets CPP each edge must be isited at least once so that the tour has the minimum length Examples of applications Mail deliery Urban waste collection (power, phone) lines inspection Transport of containers in logistic terminal

Incidence matrix of graphs It allows to represent the graph structure Two cases: undirected and directed graphs Facoltà di Ingegneria Undirected graphs Gien G=(V,E) undirected graph, A G =[a ij ], with i=1,...,n and j=1,...,m is the incidence matrix of G, where n= V and m= E, and such that 1 if e j incident on i aij = 0 otherwise Example e 2 1 e2 e3 e4 e5 1 1 0 0 0 1 e 1 e 2 0 1 1 0 0 e 5 e A 3 G = 1 0 1 1 0 0 1 0 1 1 4 e 4 3 1 2 3 4

Incidence matrix of graphs Gien the incidence matrix A G =[a ij ] the sum of non zero elements in a row gies the degree of the node associated with such row δ ( i ) = a ij Facoltà di Ingegneria The star of a node i can be defined as δ ( i ) = { e j E : aij = 1} Incidence matrices satisfy the necessary conditions for TUM (the elements must be 0, -1 or 1) A sufficient condition for an incidence matrix to be TUM is that the associated graph is bipartite A graph is bipartite if it does not contain odd cycles m j = 1 1 2 e 1 1 2 5 e 5 e 6 2 e 8 e6 e 3 8 e 7 4 e 4 7 3 6 8 3 5 7 4

Incidence matrix of graphs Directed graphs Facoltà di Ingegneria Gien G=(V,A) directed graph, A G =[a ij ], with i=1,...,n and j=1,...,m is the incidence matrix of G, where n= V and m= A, and such that a ij = 1 1 0 Using the incidence matrix we can define: δ + ( i )={a j A: a ij =1} (forward start) δ - ( i )={a j A: a ij =-1} (backward star) e 5 4 1 if i is head of a j (enters in if i is tail of a j (exits from otherwise 2 e 1 e 2 e 3 e 4 3 A G e 1 0 = 1 0 0 1 0 1 0 1 1 0 1 e2 e3 e4 e5 0 0 i i 1 1 ) ) 1 0 0 1 1 2 3 4

Adjacency matrix of graphs An alternatie representation of the graph structure Undirected graphs Facoltà di Ingegneria Gien G=(V,E) undirected graph, D G =[d ij ], with i=1,...,n and j=1,...,n is the adjacency matrix of G, where n= V and such that d ij = 1 if i is adjacent t o j 0 otherwise The matrix has n 2 elements and 2m non zero elements The sum of non zero elements in a row proides the degree of the node For undirected graphs the matrix is symmetric

Adjacency matrix of graphs Directed graphs Facoltà di Ingegneria Gien G=(V,A) directed graph, D G =[d ij ], with i=1,...,n and j=1,...,n is the adjacency matrix of G such that d ij = 1 if ( i, j ) A 0 otherwise The matrix is no more symmetric The sum of non zero elements in a row gies the number of arcs of the forward star of the associated node The sum of non zero elements in a column gies the number of arcs of the backward star of the associated node The number of not null elements of the matrix is m