# murali_lec23 - CS C341 / I S C361 Data Str uctur es...

This preview shows pages 1–6. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS C341 / I S C361 Data Str uctur es &amp; Algor ithms GRAPH AL GORI TH M S Relations and Gr aphs Flows and Gr aphs Gr aph Pr oper ties Symmetr y: Dir ected vs. Undir ected T r ansitivity: Paths and Cycles Weighted Gr aphs Degr ees and Connectedness Gr aph Repr esentation Adjacency M atr ices Adjacency Lists Edge Lists 1 02/07/11 Sundar B. CSIS, BITS, Pilani REL ATI ONS AND DATA STRUCTURES Sor ted Lists Used for captur ing total order relations Trees Used for captur ing par tial order relations E.g. order of evaluating an expression E.g. Pr ior ity order of processes Graphs Used for captur ing arbitrar y binar y relations 02/07/11 2 Sundar B. CSIS, BITS, Pilani REL ATI ONS AND GRAPHS A binar y relation R on a set S of elements is defined as a subset of S x S. I n general the pair (S,R), where R is a subset of S x S defines the relation R on elements S A relation is then modeled by a graph G defined as the pair (V,E) where V is the set of ver tices (or nodes) V models S E, a subset of V x V, is the set of edges (or links) E models R Ter minology Often wed say G models R to mean G = (V,E) models (S,R) 02/07/11 3 Sundar B. CSIS, BITS, Pilani REL ATI ONS AND GRAPHS - EXAMPLES A program is wr itt en as a set of files. (For compilation) a file may depend on another file. Capture the order of compilation (i.e. the dependencies) as a graph: G = (V,E) where V is the set of files and E = { (f1, f2) | f1 and f2 are in V, f1 depends on f2 i.e. f2 must be compiled before f1 } A political map (of regions) captures adjacency (border) relations. This can be represented as a graph: G=(V,E) where V is the set of regions and E = { (r1,r2) | r1 and r2 are in V, r1 is adjacent to (i.e. border ing) r2 } 02/07/11 4 Sundar B. CSIS, BITS, Pilani REL ATI ONS AND GRAPHS - EXAMPLES Quick Exercises: Capture the relation is a classmate of using a graph. Capture the relation is a fr iend of using a graph. Capture the relation is connected by road using a graph. Capture the relation can be seen from on locations using a graph. Capture the relation has a pointer to on data str uctures (often refer red to as data objects or just objects) Capture the relation belong to the same Facebook community on netizens Capture the relation has a hyperlink to on web pages 02/07/11 5 Sundar B. CSIS, BITS, Pilani NETWORK S/FLOWS AND GRAPHS...
View Full Document

## murali_lec23 - CS C341 / I S C361 Data Str uctur es...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online