Graph Theory and Algorithm 01

Slides:



Advertisements
Similar presentations
Connectivity - Menger’s Theorem Graphs & Algorithms Lecture 3.
Advertisements

Edge-connectivity and super edge-connectivity of P 2 -path graphs Camino Balbuena, Daniela Ferrero Discrete Mathematics 269 (2003) 13 – 20.
CSC401 – Analysis of Algorithms Lecture Notes 14 Graph Biconnectivity
Graph Searching CSE 373 Data Structures Lecture 20.
Chapter 8, Part I Graph Algorithms.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Data Structures & Algorithms Graph Search Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Graphs and Trees This handout: Trees Minimum Spanning Tree Problem.
1 Topological Sort: DFS F C G A B D E H. 2 F C G A B D E H dfs(A)
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Introduction to Graph Theory
GRAPH Learning Outcomes Students should be able to:
Data Structures Using C++ 2E
IS 2610: Data Structures Graph April 5, 2004.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
 期中测验时间:  11 月 4 日  课件 集合,关系,函数,基数, 组合数学.  Ⅰ Introduction to Set Theory  1. Sets and Subsets  Representation of set:  Listing elements, Set builder.
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Elementary Graph Algorithms CLRS Chapter 22. Graph A graph is a structure that consists of a set of vertices and a set of edges between pairs of vertices.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
Week 1 – Introduction to Graph Theory I Dr. Anthony Bonato Ryerson University AM8002 Fall 2014.
Graph Theory and Applications
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graphs Lecture 2. Graphs (1) An undirected graph is a triple (V, E, Y), where V and E are finite sets and Y:E g{X V :| X |=2}. A directed graph or digraph.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Chapter 05 Introduction to Graph And Search Algorithms.
GRAPH ALGORITHM. Graph A pair G = (V,E) – V = set of vertices (node) – E = set of edges (pairs of vertices) V = (1,2,3,4,5,6,7) E = ( (1,2),(2,3),(3,5),(1,4),(4,5),(6,7)
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
English for Economic Informatics I Tomáš Foltýnek Theoretical Foundations of Informatics.
Nattee Niparnan. Graph  A pair G = (V,E)  V = set of vertices (node)  E = set of edges (pairs of vertices)  V = (1,2,3,4,5,6,7)  E = ((1,2),(2,3),(3,5),(1,4),(4,
Leda Demos By: Kelley Louie Credits: definitions from Algorithms Lectures and Discrete Mathematics with Algorithms by Albertson and Hutchinson graphics.
Trees.
Graph Search Applications, Minimum Spanning Tree
Graphs ORD SFO LAX DFW Graphs 1 Graphs Graphs
An introduction to chordal graphs and clique trees
Subgraphs Lecture 4.
Lecture 19: CONNECTIVITY Sections
Proof technique (pigeonhole principle)
The countable character of uncountable graphs François Laviolette Barbados 2003.
Graph Algorithms Minimum Spanning Tree (Chap 23)
Graph theory Definitions Trees, cycles, directed graphs.
Introduction to Graphs
CC 215 Data Structures Graph Searching
CS120 Graphs.
Biconnectivity SEA PVD ORD FCO SNA MIA 11/16/2018 2:31 AM
Minimum Spanning Tree.
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Discrete Mathematics and its Applications Lecture 1 – Graph Theory
Elementary Graph Algorithms
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Minimum Spanning Tree Section 7.3: Examples {1,2,3,4}
Undirected Depth First Search
Chapter 11 Graphs.
CSE 373 Data Structures Lecture 16
Subgraphs, Connected Components, Spanning Trees
Text Book: Introduction to algorithms By C L R S
Miniconference on the Mathematics of Computation
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Biconnectivity SEA PVD ORD FCO SNA MIA 5/6/2019 5:08 PM Biconnectivity
Graph Theory: Cuts and Connectivity
Elementary Graph Algorithms
Biconnectivity SEA PVD ORD FCO SNA MIA 5/23/ :21 PM
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

Graph Theory and Algorithm 01 COP 6726: New Directions in Database Systems Graph Theory and Algorithm 01

Basics A graph is a pair G = (V, E) of sets such that E ⊆ [V]2. The elements of V are the vertices (or nodes, or points) of the Graph G. The elements of E are its edges (or lines). A vertex v is incident with an edge e if v ∈ e; then e is an edge at v.

Graphs If all the vertices of G are pairwise adjacent, the G is complete. A complete graph on n vertices is a Kn. Pairwise non-adjacent vertices or edges are called independent. A class of graphs that is closed under isomorphism is called a graph property. If G`⊆ G and G` contains all the edges xy ∈ E with x,y ∈ V, then G` is an induced subgraph of G. The degree (or valency) dG(v) = d(v) of a vertex v is the number |E(v)| of edges at v.

Isomorphism

Subgraph A subgraph S of a graph G is a graph such that The vertices of S are a subset of the vertices of G The edges of S are a subset of the edges of G A spanning subgraph of G is a subgraph that contains all the vertices of G Subgraph Spanning subgraph

Paths A path is a non-empty graph P=(V, E) of the form V = {x0, x1, …, xk} E = {x0x1, x1x2, …, xk-1xk} ,where the xi are all distinct. Two a-b paths are independent if and only if a and b are their only common vertices.

Cycles The minimum length of a cycle in a graph G is the girth g(G) of G. The maximum length of a cycle in G is its circumference.

Connectivity A non-empty graph G is called connected if any two of its vertices are linked by a path in G. A maximal connected subgraph of G is a component of G. The components are induced subgraphs, and their vertex sets partition V. If A,B ⊆ V and X ⊆ V ∪ E are such that every AB in G contains a vertex or an edge from X, we say that X separates the sets A and B in G. A separating set of vertices is a separator. A vertex which separates two other vertices of the same components is a cut-vertex and an edge separating its ends is a bridge.

Non connected graph with two connected components Connectivity Connected graph Non connected graph with two connected components

Connectivity G is called k-connected (for k ∈ ℕ) if G > k and G-X is connected for every set X ⊆ V with |X| < k. The greatest integer k such that G is k-connected is the connectivity k(G) of G. The greatest integer l such that G is l-edge connected is the edge-connectivity λ(G) of G.

Connectivity

Connectivity Block is a maximal connected subgraph without a cut-vertex. Thus, every block is either a maximal 2-conntected subgraph, or a bridge (with its ends), or an isolated vertex. Different blocks of G overlap in at most one vertex, which is the a cut-vertex of G.

Block Tree

Menger’s theorem Let G=(V,E) be a graph and A,B ⊆ V. Then the minimum number of vertices separating A from B in G is equal to the maximum number of disjoint A-B paths in G. A graph is k-connected if and only if it contains k independent paths between any two vertices A graph is k-edge-connected if and only if it contains k edge-disjoint paths between any two vertices.

Tree and forest An acyclic graph, one not contains any cycles, is called a forest. A connected forest is called tree. The following assentation are equivalent for a graph T: T is a tree. Any two vertices of T are linked by a unique path in T. T is minimally connected. T is maximally acyclic. The vertices at distance k from the root have height k and form the kth level of T.

Tree and forest Tree Forest

Tree A subtree of a graph is a subgraph which is a tree. If this tree is a spanning subgraph, it is called a spanning tree of the graph.

Bipartite graphs A graph G =(V,E) is called r-partite if V admits a partition into r classes such that every edge has its ends in different classes.

Matching in bipartite graphs

Complete Graph A complete graph A complete bipartite graph

Contraction and minors

Incidence and adjacency matrices Incidence matrix Adjacency matrix

Basic Graph Algorithm

Depth First Search

Depth First Search Courtesy : https:// goo.gl/QVPy1i Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: B H C G I D E F Courtesy : https:// goo.gl/QVPy1i

Depth First Search A-F A-G Function call stack: A B H C G I D E F dfs(A) A-F A-G Function call stack:

Depth First Search F-E A-F A-G Function call stack: 27 A B H C G I D visit(F) F-E E F dfs(A) A-F A-G Function call stack: 27

Depth First Search E-C E-D E-G F-E A-F A-G Function call stack: 28 A B dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 28

Depth First Search C-A C-D E-C E-D E-G F-E A-F A-G dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 29

Depth First Search C-A C-D E-C E-D E-G F-E A-F A-G dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 30

Depth First Search D-C D-F C-A C-D E-C E-D E-G F-E A-F A-G dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 31

Depth First Search D-C D-F C-A C-D E-C E-D E-G F-E A-F A-G dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 32

Depth First Search D-C D-F C-A C-D E-C E-D E-G F-E A-F A-G dfs(D) D-C D-F dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 33

Depth First Search C-A C-D E-C E-D E-G F-E A-F A-G dfs(C) C-A C-D B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 34

Depth First Search E-C E-D E-G F-E A-F A-G Function call stack: 35 A B dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 35

Depth First Search E-C E-D E-G F-E A-F A-G Function call stack: 36 A B dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 36

Depth First Search E-C E-D E-G F-E A-F A-G Function call stack: 37 A dfs(G) B H C G dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 37

Depth First Search E-C E-D E-G F-E A-F A-G Function call stack: 38 A B dfs(E) E-C E-D E-G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 38

Depth First Search F-E A-F A-G Function call stack: 39 A B H C G I D dfs(F) F-E E F dfs(A) A-F A-G Function call stack: 39

Depth First Search A-F A-G Function call stack: 40 A B H C G I D E F dfs(A) A-F A-G Function call stack: 40

Depth First Search A-F A-G Function call stack: 41 A B H C G I D E F dfs(A) A-F A-G Function call stack: 41

Breadth First Search

Breadth First Search A B C D E F G H I FIFO Queue Closed Nodes

Breadth First Search FIFO Queue Closed Nodes A B C FIFO Queue G H I FIFO Queue Closed Nodes FIFO Queue Closed Nodes FIFO Queue Closed Nodes

Dijkstra Algorithm

Dijkstra Algorithm 2 1 A B C 1 1 1 1 1 D E F 1 1 3 1 G H I A B C D E F Priority Queue ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ Closed Nodes

Dijkstra Algorithm 2 1 Priority Queue Closed Nodes A B C D E F G H I A A B C 1 1 1 Priority Queue Closed Nodes A B C D E F G H I 1 1 D E F 1 1 Priority Queue Closed Nodes A B C D E F G H I 3 1 G H I Priority Queue Closed Nodes A B C D E F G H I

Bellman Ford

Bellman-Ford Algorithm 2 -1 A B C 1 1 1 1 1 D E F 1 1 -3 1 G H I A B C D E F G H I ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

Bellman-Ford Algorithm 2 -1 A B C D E F G H I A B C 1 1 1 1 1 D E F 1 1 -3 1 G H I

Potential Function

Potential Function 1 1 -2 1 A B C D

Potential Function d ( u, v) = d (u, v) – p(v) + p (u) 1 1 -1 1 -2 1 A 1 -1 1 -2 1 A B C D

Potential Function d ( u, v) = d (u, v) – p(v) + p (u) 1 1 -1 A B C D

Take Home Message Basic Graph theory Basic Graph Algorithms