Graph Theory By: Maciej Kicinski Chiu Ming Luk. Extract Triple words.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms Graph Algorithms
Advertisements

Two algorithms for checking emptiness. How to check for emptiness? Is L (A) = ; ? Need to check if there exists an accepting computation (passes through.
Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
Topological Sort Topological sort is the list of vertices in the reverse order of their finishing times (post-order) of the depth-first search. Topological.
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 22.
Elementary Graph Algorithms Depth-first search.Topological Sort. Strongly connected components. Chapter 22 CLRS.
Graph Theory, DFS & BFS Kelly Choi What is a graph? A set of vertices and edges –Directed/Undirected –Weighted/Unweighted –Cyclic/Acyclic.
Graph Traversals Visit vertices of a graph G to determine some property: Is G connected? Is there a path from vertex a to vertex b? Does G have a cycle?
Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u
TECH Computer Science Graphs and Graph Traversals  // From Tree to Graph  // Many programs can be cast as problems on graph Definitions and Representations.
Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u
Breadth-First and Depth-First Search
GRAPHS AND GRAPH TRAVERSALS 9/26/2000 COMP 6/4030 ALGORITHMS.
Graph Search Methods Spring 2007 CSE, POSTECH. Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u. A search method.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
Graphs CS3240, L. grewe.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Implementation of Graph Decomposition and Recursive Closures Graph Decomposition and Recursive Closures was published in 2003 by Professor Chen. The project.
Graphs CS-240/341. Graphs Used for representing many-to-many relationships –can take two forms directed (digraph) - a finite set of elements called vertices.

PSUCS322 HM 1 Languages and Compiler Design II Strongly Connected Components Herbert G. Mayer PSU Spring 2010 rev.: 5/28/2010.
1 Data Structures DFS, Topological Sort Dana Shapira.
DAST 2005 Tirgul 11 (and more) sample questions. DAST 2005 Q.Let G = (V,E) be an undirected, connected graph with an edge weight function w : E→R. Let.
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
Alyce Brady CS 510: Computer Algorithms Depth-First Graph Traversal Algorithm.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Graphs.
Spring 2015 Lecture 10: Elementary Graph Algorithms
Chapter 14 Graphs. © 2004 Pearson Addison-Wesley. All rights reserved Terminology G = {V, E} A graph G consists of two sets –A set V of vertices,
Data Structures and Algorithms Ver. 1.0 Session 17 Objectives In this session, you will learn to: Implement a graph Apply graphs to solve programming problems.
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
Algorithm for obtaining the connected components of a graph Samia Qader 252a-az HW # 6 all examples obtained from LEDA software in directory: 252a/handout/demo/graphwin/graphwin.
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Jan Topological Order and SCC Edge classification Topological order Recognition of strongly connected components.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
1 Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting Yang,
COSC 2007 Data Structures II
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
DIRECTED ACYCLIC GRAPHS AND TOPOLOGICAL SORT CS16: Introduction to Data Structures & Algorithms Tuesday, March 10,
Properties and Applications of Depth-First Search Trees and Forests
Strongly Connected Components for Directed Graphs Kelley Louie Credits: graphs by /demo/graphwin/graphwin.
Breadth-first and depth-first traversal CS1114
 2004 SDU 1 Lecture5-Strongly Connected Components.
Graphs + Shortest Paths David Kauchak cs302 Spring 2013.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
Honors Track: Competitive Programming & Problem Solving 2-Satisfiability José Kuiper.
Graph Theory Def: A graph is a set of vertices and edges G={V,E} Ex. V = {a,b,c,d,e} E = {ab,bd,ad,ed,ce,cd} Note: above is a purely mathematical definition.
Week 11 - Wednesday.  What did we talk about last time?  Exam 2  And before that:  Graph representations  Depth first search.
© 2006 Pearson Addison-Wesley. All rights reserved14 B-1 Chapter 14 (continued) Graphs.
Graph Search Applications, Minimum Spanning Tree
Breadth-First Search (BFS)
Tracing An Algorithm for Strongly Connected Components that uses Depth First Search Graph obtained from Text, page a-al: Geetika Tewari.
Discrete Math 2 Weighted Graph Search Tree
Depth-First Search.
More Graph Algorithms.
Graph Search Applications
Chapter 22: Elementary Graph Algorithms
Connected Components, Directed Graphs, Topological Sort
Richard Anderson Autumn 2016 Lecture 5
Strongly Connected Components
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Jiří Vyskočil, Radek Mařík 2013
Richard Anderson Winter 2019 Lecture 6
Richard Anderson Winter 2019 Lecture 5
Richard Anderson Autumn 2015 Lecture 6
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 By: Maciej Kicinski Chiu Ming Luk

Extract Triple words

Extract Triple words

Extract Double words

Extract Double words

Adjacency-matrix Representation

Adjacency-matrix Representation

Adjacency-lists Representation

Depth-First Search

Depth-First Search

Breath-First Search

Breath-First Search

Strongly connected Component

Kosaraju's algorithm Let G be a directed graph and S be an empty stack. While S does not contain all vertices: –Choose an arbitrary vertex v not in S. Perform a depth-first search starting at v. Each time that depth-first search finishes expanding a vertex u, push u onto S. Reverse the directions of all arcs to obtain the transpose graph. While S is nonempty: –Pop the top vertex v from S. Perform a depth-first search starting at v. The set of visited vertices will give the strongly connected component containing v; record this and remove all these vertices from the graph G and the stack S.

Kosaraju's algorithm

Simplicial Complexes S0 – S1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} S2 - {5,6,7}

Tarjan Algorithm For a directed graph: Checks every edge starting from a node For every node lead to by an edge, checks edges for nodes that have not been checked yet repeats until every node that can be checked from these nodes has been check All checked nodes are Strongly Connected. Any node that could not have been reached is not strongly connected to the nodes reached.

Tarjan Algorithm To find Strong Connected Components(SCC) Take simplicial complexes: Δ 0 – Δ 1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} Δ 2 – {5,6,7} And make each one a node with edges connecting relation Δ 0 – Δ 1 – Δ 2 – 15

Graph Δ 0 – Δ 1 – {0,1} {0,2} {1,2} {3,4} {5,6} {5,7} {6,7} Δ 2 - {5,6,7}

Strongly Connected Components Connected nodes are consider strongly connected SCC 0 – {0,1} {0,2} {1,2} SCC 1 – 3 4 {3,4} SCC 2 – {5,6} {5,7} {6,7} {5,6,7}

Simplicial Complex and SCC Graph Can reduce # of nodes since we know the relation in simplicial complexes we then only need to find relation between the different complexes. SCC 0 – {0,1} {0,2} ({1,2}) SCC 1 – {3,4} SCC 2 – {5,6,7}

Run Time Tarjan Algorithm runs in O(e + n) time where e is edges and n is number of nodes Sort – O(n*log(n)) but only on singles Build Nodes – O(n*log(n)) orO(n) Build Edges – O(n) or O(n*log(n)) Tarjan Algorithm finished on ≈ 1 mil nodes in less than a second.