Implementation of Graph Decomposition and Recursive Closures Graph Decomposition and Recursive Closures was published in 2003 by Professor Chen. The project.

Slides:



Advertisements
Similar presentations
SUNY Oneonta Data Structures and Algorithms Visualization Teaching Materials Generation Group Binary Search Tree A running demonstration of binary search.
Advertisements

TREES Chapter 6. Trees - Introduction  All previous data organizations we've studied are linear—each element can have only one predecessor and successor.
Lecture 16: DFS, DAG, and Strongly Connected Components Shang-Hua Teng.
CS 312 – Graph Algorithms1 Graph Algorithms Many problems are naturally represented as graphs – Networks, Maps, Possible paths, Resource Flow, etc. Ch.
Chapter 5 Decrease and Conquer. Homework 7 hw7 (due 3/17) hw7 (due 3/17) –page 127 question 5 –page 132 questions 5 and 6 –page 137 questions 5 and 6.
Discrete Structures Lecture 13: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
Applications of graph traversals
Trees Chapter 8.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Makeup Lecture Chapter 23: Graph Algorithms Depth-First SearchBreadth-First.
Fall 2007CS 2251 Trees Chapter 8. Fall 2007CS 2252 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information.
Binary Trees Terminology A graph G = is a collection of nodes and edges. An edge (v 1,v 2 ) is a pair of vertices that are directly connected. A path,
Trees Chapter 8. Chapter 8: Trees2 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information To learn how.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
1 Data Structures DFS, Topological Sort Dana Shapira.
COMP171 Depth-First Search.
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
Depth-first search COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar to pre-order.
Reachability Queries Sept. 2014Yangjun Chen ACS Outline: Reachability Query Evaluation What is reachability query? Reachability query evaluation.
Recursive Graph Deduction and Reachability Queries Yangjun Chen Dept. Applied Computer Science, University of Winnipeg 515 Portage Ave. Winnipeg, Manitoba,
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
Depth-First Search Lecture 24 COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Trees Chapter 8. 2 Tree Terminology A tree consists of a collection of elements or nodes, organized hierarchically. The node at the top of a tree is called.
Trees. Tree Terminology Chapter 8: Trees 2 A tree consists of a collection of elements or nodes, with each node linked to its successors The node at the.
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
Lecture 81 Data Structures, Algorithms & Complexity Tree Algorithms GRIFFITH COLLEGE DUBLIN.
Lecture 10 Trees –Definiton of trees –Uses of trees –Operations on a tree.
Trees Chapter 8. Chapter 8: Trees2 Chapter Objectives To learn how to use a tree to represent a hierarchical organization of information To learn how.
Discussion #32 1/13 Discussion #32 Properties and Applications of Depth-First Search Trees.
Graphs.
Compiled by: Dr. Mohammad Omar Alhawarat
Trees Chapter 8. 2 Tree Terminology A tree consists of a collection of elements or nodes, organized hierarchically. The node at the top of a tree is called.
Lecture 13 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
Discrete Structures Trees (Ch. 11)
Jan Topological Order and SCC Edge classification Topological order Recognition of strongly connected components.
Topological Sort (an application of DFS) CSC263 Tutorial 9.
Graph Introduction, Searching Graph Theory Basics - Anil Kishore.
Computer Science 112 Fundamentals of Programming II Introduction to Trees.
CSE 3358 NOTE SET 10 Data Structures and Algorithms.
Trees 2: Section 4.2 and 4.3 Binary trees. Binary Trees Definition: A binary tree is a rooted tree in which no vertex has more than two children
M180: Data Structures & Algorithms in Java Trees & Binary Trees Arab Open University 1.
Trees, Binary Search Trees, Balanced Trees, Graphs Graph Fundamentals Telerik Algo Academy
Binary Search Trees (BST)
Properties and Applications of Depth-First Search Trees and Forests
Answers to Assignment #2
Hello Everyone!!! 1. Tree And Graphs 2 Features of Trees  Tree Nodes Each node have 0 or more children A node have must one parent  Binary tree Tree.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
Now, Chapter 5: Decrease and Conquer Reduce problem instance to smaller instance of the same problem and extend solution Solve smaller instance Extend.
1 Trees : Part 1 Reading: Section 4.1 Theory and Terminology Preorder, Postorder and Levelorder Traversals.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
11 Graph Search Algorithms. 2 What parts of the graph are reachable from a given vertex ?
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
DATA STRUCURES II CSC QUIZ 1. What is Data Structure ? 2. Mention the classifications of data structure giving example of each. 3. Briefly explain.
Data Structure and Algorithms
CSCE 210 Data Structures and Algorithms
Recursive Objects (Part 4)
Lecture 11 Graph Algorithms
Binary Search Tree (BST)
Tree.
Lecture 12 Graph Algorithms
Topological Sort (an application of DFS)
Depth-First Search.
Graph Algorithms Using Depth First Search
Topological Sort (an application of DFS)
Lecture 11 Graph Algorithms
Non-Linear data structures
Data Structures Using C++ 2E
Assignment #2 (Assignment due: Nov. 06, 2018) v1 v2 v3 v4 v5
Graph Traversals Some applications require visiting every vertex in the graph exactly once. The application may require that vertices be visited in some.
NATURE VIEW OF A TREE leaves branches root. NATURE VIEW OF A TREE leaves branches root.
Presentation transcript:

Implementation of Graph Decomposition and Recursive Closures Graph Decomposition and Recursive Closures was published in 2003 by Professor Chen. The project is an implementation of the algorithm described in the paper. The main idea behind this is tree labeling and graph decomposition. It is a better computational complexity than any existing algorithms for this problem.

The main purpose of my project is to predict whether there are or are not any relations between two random nodes from a graph.

Design algorithm 1. Graph generation 2. Find a tree 3. Find topological sequence of the graph 4. Scan along the topological sequence and construct a pair sequence for each node

Data structure design prepost  a 25  b 77  c 33 d 86 e 41 f 52 g 64 c g / d / g / f / e f  (4,1)  (5,2)  (6,4) / (7,7) / (3,3) / (8,6)  (6,4)  (5,2)  (4,1) / (2,5) / (6,4)  (5,2)  (4,1) / (5,2) / (4,1)

1.Graph generation The graph is saved in a txt file. Read from file and store in a link list. Graph.txt Graph a c c e c f a g g e g f b d d g d f a b c d e f g c g / d / g / f / e f

2.Find a tree Find the maximal branching of the graph Introduce a virtual root r for the branching and an edge r r i for each T i, obtaining a tree G r. (a)

2.Find a tree Preorder numbers are generated for the tree nodes during a depth-first search. Postorder numbers are generated for the tree nodes during a bottom-up search. For any directed tree G r, we can label it as follows. By traversing G r in preorder, each node v will obtain a number pre(v) to record the order in which the nodes of the tree are visited. In a similar way, by traversing T in postorder, each node v will get another number post(v).

These two numbers can be used to characterize the ancestor-descendant relationships of nodes as follows. Let v and v’ be two nodes of a tree T. Then, v’ is a descendant of v if pre(v’) >pre(v) and post(v’) < post(v).

3.Find topological sequence of the graph Topological-Sort ( G ) 1. call DFS ( G ) to compute finishing times f [ v ] for all v  V 2. as each vertex is finished, insert it onto the front of a linked list 3. return the linked list of vertices

If a node v is labeled with (pre, post) in G r, it will be initially labeled with the same pair (pre, post) in G. Gr Tree labeling Graph labeling

sort the nodes of G topologically b d a g c f e (V i, V j )  E implies V j that appears before V i in the sequence of the nodes. Find a topological sequence of the graph: e, f, c, g, a, d, b

4.Scan along the topological sequence and construct a pair sequence for each node Scan the topological sequence of the nodes from the beginning to the end and at each step we do the following: To compute the pair sequence for each node.The pairs to be generated for a node v are simply stored in a link list A v.

Let v 1,..., v k be the children of v. Merge A v with each A vi for the child node v i (i = 1,..., k) as follows. Assume A v = p 1 → p 2 →... → p g and A vi = q 1 → q 2 →... → q h, We step through both A v and from left to right. Let p i and q j be the pairs encountered. We’ll make the following checkings. (1) If p i. pre > q j. pre and p i. post > q j. post, insert q j into A v after p i-1 and before p i and move to q j+1. (2) If p i. pre > q j. pre and p i. post < q j. post, remove p i from A v and move to p i+1. (*p i is subsumed by q j.* ) (3) If p i. pre q j. post, ignore q j and move to q j+1. (*q j is subsumed by p i ; but it should not be removed from A vi.* ) (4) If p i. pre < q j. pre and p i. post < q j. post, ignore p i and move to p i+1. (5) If p i = p j ’ and q i = q j ’, ignore both (p i, q i ) and (p j ’, q j ’), and move to (p i+1, q i+1 ) and (p j+1 ’,q j+1 ’), respectively.

Scan the topological sequence of the nodes from the beginning to the end. e(4,1), f(5,2), c(3,3) g(6,4), a(2,5), d(8,6), b(7,7) Compute the pair sequence for each node: For example: c(3,3) A c (3,3) g(6,4) A g (4,1) (5,2) (6,4) e(4,1) f(5,2) e(4,1) f(5,2) A e (4,1) A f (5,2) A e (4,1) A f (5,2)

Result of all the nodes : A e (4,1) A f (5,2) A c (3,3) A g (4,1)  (5,2)  (6,4) A a (2,5) A d (4,1)  (5,2)  (6,4)  (8,6) A b (4,1)  (5,2)  (6,4)  (7,7)

Data Structure prepost  1 25  2 77  / 4 / 7 / 6 / 5 6  (4,1)  (5,2)  (6,4) / (7,7) / (3,3) / (8,6)  (6,4)  (5,2)  (4,1) / (2,5) / (6,4)  (5,2)  (4,1) / (5,2) / (4,1)

Thank you !