Dendrogram-based Algorithm Weighted Graphs Flooding Algorithm – Implementation - Parallelization Claude Tadonki and Fernand Meyer Centre de Recherche en.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Single Source Shortest Paths
CHAPTER 7 Greedy Algorithms.
Sorting an Intransitive Total Ordered Set
COL 106 Shweta Agrawal and Amit Kumar
Binary Trees CSC 220. Your Observations (so far data structures) Array –Unordered Add, delete, search –Ordered Linked List –??
Comp 122, Spring 2004 Binary Search Trees. btrees - 2 Comp 122, Spring 2004 Binary Trees  Recursive definition 1.An empty tree is a binary tree 2.A node.
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
Greedy Algorithms Greed is good. (Some of the time)
Data Structures Using C++
Junction Trees: Motivation Standard algorithms (e.g., variable elimination) are inefficient if the undirected graph underlying the Bayes Net contains cycles.
Advanced Topics in Algorithms and Data Structures 1 Rooting a tree For doing any tree computation, we need to know the parent p ( v ) for each node v.
Binary Search Trees Briana B. Morrison Adapted from Alan Eugenio.
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,
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
1 Trees. 2 Outline –Tree Structures –Tree Node Level and Path Length –Binary Tree Definition –Binary Tree Nodes –Binary Search Trees.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Dynamic Sets and Data Structures Over the course of an algorithm’s execution, an algorithm may maintain a dynamic set of objects The algorithm will perform.
CS4432: Database Systems II
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Trees.
Binary Trees Chapter 6.
Heapsort Based off slides by: David Matuszek
May 5, 2015Applied Discrete Mathematics Week 13: Boolean Algebra 1 Dijkstra’s Algorithm procedure Dijkstra(G: weighted connected simple graph with vertices.
COSC2007 Data Structures II
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary search trees.
CS 1031 Tree Traversal Techniques; Heaps Tree Traversal Concept Tree Traversal Techniques: Preorder, Inorder, Postorder Full Trees Almost Complete Trees.
Lecture 10 Trees –Definiton of trees –Uses of trees –Operations on a tree.
Heaps, Heapsort, Priority Queues. Sorting So Far Heap: Data structure and associated algorithms, Not garbage collection context.
May 1, 2002Applied Discrete Mathematics Week 13: Graphs and Trees 1News CSEMS Scholarships for CS and Math students (US citizens only) $3,125 per year.
Minimum Spanning Trees CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Binary Trees. Binary Tree Finite (possibly empty) collection of elements A nonempty binary tree has a root element The remaining elements (if any) are.
The Binary Heap. Binary Heap Looks similar to a binary search tree BUT all the values stored in the subtree rooted at a node are greater than or equal.
Chapter 21 Binary Heap.
Dijkstra’s Algorithm Supervisor: Dr.Franek Ritu Kamboj
Preview  Graph  Tree Binary Tree Binary Search Tree Binary Search Tree Property Binary Search Tree functions  In-order walk  Pre-order walk  Post-order.
Lecture 3: Uninformed Search
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
Queues, Stacks and Heaps. Queue List structure using the FIFO process Nodes are removed form the front and added to the back ABDC FrontBack.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Trees, Binary Search Trees, Balanced Trees, Graphs Graph Fundamentals Telerik Algo Academy
Topological Sort: Definition
Trees Dr. Yasir Ali. A graph is called a tree if, and only if, it is circuit-free and connected. A graph is called a forest if, and only if, it is circuit-free.
Chapter 10: Trees A tree is a connected simple undirected graph with no simple circuits. Properties: There is a unique simple path between any 2 of its.
HEAPS. Review: what are the requirements of the abstract data type: priority queue? Quick removal of item with highest priority (highest or lowest key.
AVL Trees and Heaps. AVL Trees So far balancing the tree was done globally Basically every node was involved in the balance operation Tree balancing can.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
1 Joe Meehean. A A B B D D I I C C E E X X A A B B D D I I C C E E X X  Terminology each circle is a node pointers are edges topmost node is the root.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
Trees By JJ Shepherd. Introduction Last time we discussed searching and sorting in a more efficient way Divide and Conquer – Binary Search – Merge Sort.
Binary Search Trees What is a binary search tree?
Trees Chapter 15.
MCS680: Foundations Of Computer Science
Source Code for Data Structures and Algorithm Analysis in C (Second Edition) – by Weiss
B+ Tree.
Week 11 - Friday CS221.
Lectures on Network Flows
Data Structures and Database Applications Binary Trees in C#
Trees and Binary Trees.
More Graph Algorithms.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Tree.
Heaps Chapter 6 Section 6.9.
Presentation transcript:

Dendrogram-based Algorithm Weighted Graphs Flooding Algorithm – Implementation - Parallelization Claude Tadonki and Fernand Meyer Centre de Recherche en Informatique Centre de Morphologie Mathématique Mines ParisTech TIMC Project Arnaud de La Fortelle et Fabien Moutarde (CAOR) Matthieu Faessel, Serge Koudoro, Beatriz Marcotegui et Fernand Meyer (CMM) Claude Tadonki, Laurent Daverio et Francois Irigoin (CRI) TIMC Project Arnaud de La Fortelle et Fabien Moutarde (CAOR) Matthieu Faessel, Serge Koudoro, Beatriz Marcotegui et Fernand Meyer (CMM) Claude Tadonki, Laurent Daverio et Francois Irigoin (CRI) Séminaire au Centre de Morphologie Mathématique (Mines ParisTech) Fontainebleau – January 27, 2014

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) We study a decomposition algorithm based on the structure of dendrogram Dijkstra algorithm is greedy Berge algorithm is dynamical programming

(1) Build the dendrogram (this is a n-ary tree, we have considered a binary correspondance) (2) Distribute the ceiling values of the vertices among the subdendrograms (this is a mintree) (3) Flood the dendrogram from its leaves until we get the flooding levels of all vertices. Theses are the main steps of the dendrogram-based algorithm. Dendrogram based algorithm has several strengths - can be used to generate information from a local input (flooding from a single vertex) - exposes parallelism (when dismantling subdendrograms) - several floodings of the same graph can be performed using its dendrogram structure. This aspect is particularly interesting because flooding from the dendrogram is very fast compared to the cost of constructing the dendrogram structure itself. - is potentially efficient because key information are handled at the level of the sets (rather than individual vertices). Other algorithms are global, so will always process with and for the whole graph, Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) Live demo !!!

D ← Ø S ← {all edges (u, v, w) of the graph} while(S ≠ Ø ){ //we select the edge with minimum cost (u, v) ← min_w(S); //we can sort the list of edges and select on top //we remove that edge from S S ← S – {(u, v)}; //we get the id the of the root subdendrogram containing u d1 ← id_root_subdendrogram(u); //we get the id the of the root subdendrogram containing v d2 ← id_root_subdendrogram(v); //we create a singleton subdendrogram if no one was so far created if(d1 == NULL) d1 ← dendrogram_singleton({u}); if(d2 == NULL) d2 ← dendrogram_singleton({v}); //we merge the two subdendrogam d1 and d2 to form a new one (parent) if(d1 ≠ d2) D ← D  d; d ← dendrogram_merge(d1, d2); endif } dendrogram_singleton({u}) creates a subdendrogram with singleton {u} If u and v belong to an existing subdendrogram, then we avoid recreating it id_root_subdendrogram(u) is obtained by climbing from dendrogram_singleton({u}) to the maximal subdendrogram following the parent (successor) relation. This function is the most time consuming of the construction. Its global impact depends on the depth or height of the dendrogram tree. Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI)

In (a), getting the root from node s will cost 1, 2, 3, 4, and 5 steps respectively. In (b), getting the root from node s will cost 1, 2, 3, and 4 steps respectively. (a)and (b) are linear graphs, so each edge leads to a subdendrogram. This is not the case with any graph, like those containing cycles. (a)Dendrogram constructed from a linear graph Depth = 7 (b) Dendrogram constructed from a linear graph Depth = 8 For each subdendrogram, we keep the outgoing edge with minimum cost. Having the list of edges sorted makes this easy, since the minimum outgoing edge is exactly the one connecting the subdendrogram to its parent. Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) Going from a given leave to the root of its containg sub-dendrogram is so repeated that it costs. We should move from the previous root (so, store the roots!).

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) //we get the leaf subdendrogram from which twe start the flooding process d ← leaf_subdendrogram(x) //we go up while the ceiling is still greather that the diameter while((!is_root(d))&&(ceil(d) > diam(d))) d ← pred(d); //we have reached a root and still get a ceiling greather that the diameter //we set the definitive flooding values of this subdendrogram to ceil(d) if(ceil(d) > diam(d)) set_flooding_level(d, ceil(d)); else dismantle_ancestors(d, ceil(d)); The dismantling process breaks the (sub)dendrogram into independent root subdendrograms. Newly created root subdendrograms during the dismantling process are put into a FIFO queue. Each root subdendrogram is flooded through its vertex with the minimum id (value into the FIFO). flood_from_vertex (x) The complete flooding process is achieved using the following loop //the last subdendrogram we have created is maximal, thus a root FIFO_root_to_explore[0] ← lastly_created_subdendrogram nb_root_to_explore ← 1 for(i = 0; i < nb_root_to_explore; i++) flood_from_vertex(get_vertex_with_min_id(FIFO_root_to_explore[i]); The FIFO will be populated during the dismantling processes and nb_root_to_explore will be incremented accordingly. In which order should we explore the sub-dendrograms ? Does this impact on the decomposition ? Perf ?

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) while(!is_root(d)){ for(i = 0; i< nb_children(d); i++){ e ← get_child_subdendrogram(d, i); cut_relationship(e, d); //e is no longer a child of d (dismantling) //the min_out_edge is set to max(min_out_edge, ceil(d)) VERY IMPORTANT!!! if(min_out_edge(d) < ceil(d)) set_min_out_edge(e, ceil(d)); if(ceil(e) > min_out_edge(e)) set_ceil(e, min_out_edge(e)); //update of ceil(e) if(ceil(e) > diam(e)) set_flooding_level(e, ceil(e)); else{FIFO_root_to_explore[nb_root_to_explore] = e; nb_root_to_explore++;} } d ← pred(d); } The minimum outgoing edge is compared to the ceiling of the parent, and we take the maximum. The dismantling process can either terminate the flooding of a subdendrogram or make it independent. dismantling_ancestors(d)

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) typedef struct { int edge_id; // the id of the edge used to cerate this dendrogram (by merging) char is_leaf_left; // tells if the left child is a (sub)dendrogram or vertex char is_leaf_right; // tells if the right child is a (sub)dendrogram or vertex double diam; // diameter of the (sub)dendrogram double min_outedge; // the outgoing edge with the minimum cost int size; // number of vertices of the support of this (sub)dendrogram double ceil; // global ceiling of the dendrogram (obtained when propagating the input ceiling values) double flood; // flooding value of the dendrogram (TO BE COMPUTED) int smallest_vertex; // we keep the id of the vertex with the smallest ceiling int pred; // the predecessor of this (sub)dendrogram (its parent in the hierarchical structure) int child_left; // a dendrogram is obtained by fusing two subdendrograms (left, right) int child_right; // right child } dendro; typedef struct { int nb_nodes; int nb_edges; int max_degree; double *weight; // weight of the vertices (if any) int *neighbors; // neighborhood of the nodes (array of size nb_nodes*max_degree) double *values; // values in the edges (array of size nb_nodes*max_degree) } graph;

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI)

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) The height of the dendrogram is moderate Building the dendrogram predominates We outperform Dijkstra by factor > 2 The height of the dendrogram is more related to the density We significantly outperform Dijkstra Could we eliminate inoffensive edges. The flooding step is noticeably fast (10% of the overall time)

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) Number of nodes: Number of edges: Number of nodes: Number of edges: Neighborhood graph generated by morph-m Flooding values computed by the dendrogram-based algorithm Constructing the dendrogram: s Flooding process: s Whole algorithm: s Basic Dijsktra algorithm: s Constructing the dendrogram: s Flooding process: s Whole algorithm: s Basic Dijsktra algorithm: s

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) Dismantling isolates independent subdendrograms which can be explored in parallel Care about threads creation overhead Contend the effect of unbalanced load The flooding step can thus be parallelized We consider a multithread implementation using pthread We create our threads once and each iterates on available subdendrograms isolated during dismantling The threads get their exploration tasks (subdendrograms) from a common pool in a round robbing way.

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI)

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) TIMC webpage Simulator Results & code Report

Claude Tadonki (CRI) Fernand Meyer (CMM) Dendrogram-based algorithm for graph flooding under ceiling constraints TIMC project – Mines ParisTech (CAOR/CMM/CRI) Parallelize the construction of the dendrogram How to get the dendrogram of a modified graph from that of the original ? Consider load balanced from the size of the subdendrograms (instead of their number) Mathematical programming appraoches