Graph Data Structures - Data Structures and Algorithm - Lecture Slides, Slides of Data Structures and Algorithms

Some concept of Data Structures and Algorithm are Permutation, Representation, Implemented, Algorithm Design, Dynamic Programming, Graph Data Structures, String Processing, General Trees. Main points of this lecture are: Graph Data Structures, Sort Yourselves, Alphabetical, Order, Midterms Efficiently, Return, Graphs, Unifying Themes, Computer Science, Vertices

Typology: Slides

2012/2013

Uploaded on 04/27/2013

shareeka_555
shareeka_555 🇮🇳

4

(6)

74 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Graph Data Structures
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Graph Data Structures - Data Structures and Algorithm - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Graph Data Structures

Sort Yourselves

Sort yourselves in alphabetical order so I can return the midterms efficiently!

Road Networks

In modeling a road network, the vertices may represent the cities or junctions, certain pairs of which are connected by roads/edges.

vertices - cities edges - roads

Stony Brook Green Port Orient Point

Montauk

Shelter Island

Sag Harbor

Riverhead

Islip

Electronic Circuits

In an electronic circuit, with junctions as vertices as components as edges.

vertices: junctions edges: components

Directed vs. Undirected Graphs

A graph G = (V, E) is undirected if edge (x, y) ∈ E implies that (y, x) is also in E.

undirected directed

Road networks between cities are typically undirected. Street networks within cities are almost always directed because of one-way streets. Most graphs of graph-theoretic interest are undirected.

Weighted vs. Unweighted Graphs

In weighted graphs, each edge (or vertex) of G is assigned a numerical value, or weight.

unweighted

5

9 2

5

4 7

3

7

12 weighted

3

The edges of a road network graph might be weighted with their length, drive-time or speed limit. In unweighted graphs, there is no cost distinction between various edges and vertices.

Sparse vs. Dense Graphs

Graphs are sparse when only a small fraction of the possible number of vertex pairs actually have edges defined between them.

sparse dense

Graphs are usually sparse due to application-specific con- straints. Road networks must be sparse because of road junctions. Typically dense graphs have a quadratic number of edges while sparse graphs are linear in size. Docsity.com

Cyclic vs. Acyclic Graphs

An acyclic graph does not contain any cycles. Trees are connected acyclic undirected graphs.

cyclic acyclic

Directed acyclic graphs are called DAGs. They arise naturally in scheduling problems, where a directed edge (x, y) indicates that x must occur before y.

Embedded vs. Topological Graphs

A graph is embedded if the vertices and edges have been assigned geometric positions.

embedded topological

Example: TSP or Shortest path on points in the plane. Example: Grid graphs. Example: Planar graphs.

Labeled vs. Unlabeled Graphs

In labeled graphs, each vertex is assigned a unique name or identifier to distinguish it from all other vertices.

unlabeled labeled

B C

D E G F

A

An important graph problem is isomorphism testing , deter- mining whether the topological structure of two graphs are in fact identical if we ignore any labels.

If I am your friend, does that mean you are my

friend?

A graph is undirected if (x, y) implies (y, x). Otherwise the graph is directed. The “heard-of” graph is directed since countless famous people have never heard of me! The “had-sex-with” graph is presumably undirected, since it requires a partner.

Am I my own friend?

An edge of the form (x, x) is said to be a loop. If x is y’s friend several times over, that could be modeled using multiedges , multiple edges between the same pair of vertices. A graph is said to be simple if it contains no loops and multiple edges.

How close is my link to the President?

If I were trying to impress you with how tight I am with Mel Brooks, I would be much better off saying that Uncle Lenny knows him than to go into the details of how connected I am to Uncle Lenny. Thus we are often interested in the shortest path between two nodes.

Is there a path of friends between any two

people?

A graph is connected if there is a path between any two vertices. A directed graph is strongly connected if there is a directed path between any two vertices.