Uploaded on:
GraphsGraph ADT-What is a chart?- Graph methodsData structure for diagrams Edge rundown structure, nearness liststructure, contiguousness matrixGraph Traversal-Depth-first hunt Breadth-initially searchDirected diagrams. The Graph Abstract Data Type. . . u. v. (Toronto). (Winnipeg). (u, v). .
Slide 1

Diagrams Ed. 2. furthermore, 3.: Chapter 12 Ed. 4.: Chapter 13

Slide 2

Graphs Graph ADT - What is a diagram? - Graph strategies Data structure for diagrams - Edge list structure, nearness list structure, contiguousness framework Graph Traversal - Depth-first hunt - Breadth-first inquiry Directed charts

Slide 3

The Graph Abstract Data Type

Slide 4

( u , v ) u v (Toronto) (Winnipeg) ( v , u )

Slide 5

u v (New York) (Winnipeg) ( v , u )

Slide 18


Slide 37

Graph Methods

Slide 42

Data Structure Exercises 20.1

Slide 43

Data Structure for Graphs

Slide 45

component c1 c2 rank c3

Slide 46

Edge Objects The edge object for an edge e putting away component o has information fields for A reference to o · A Boolean marker of whether e is guided or not · References to the vertex objects in V connected with the endpoint vertices of e (if the edge e is undir ected) or to the root and goal vertices of e (if the edge e is coordinated) · A reference to the position of the edge - object in holder E Note: The last information field is the rank of the edge object in the compartment E if E is a vector.

Slide 47

component With an edge show, a few strategies (edge - based) are quick while others require a few endeavors. For instance, strategies endVertices(), source(), and goal() are quick since we can get to edges straightforwardly. end vertex 1 or 0 end vertex

Slide 52

The Adjacency List Structure contiguousness list The structure for a diagram develops the edge list G structure. Like the edge list structure, the contiguousness list structure has a holder for the vertices and for the edges. V E More information structures and fields are added to vertex questions and edge objects. The vertex object holds a reference to a holder ( ), v I v · called the frequency compartment, that stores references to the edges occurrence on . On the off chance that coordinated edges are permitted, v then we segment ( ) into ( ) , ( ) , and ( ) that I v I v I v I v in ou t un store the in - coming, out - going, and undirected edges occurrence to . v

Slide 53

AC201 AC112 Ottawa JG120 AC200 Vancouver Winnipeg Calgary JG131 WJ75 WJ35 Toronto JG130 The edge object for an edge ( u , v ) holds references to the · positions of the edge in the occurrence compartments I ( u ) and I ( v ). Case:

Slide 57

Here is the manner by which the data is put away: Assume there are n vertices in the chart A vertex v additionally stores an unmistakable whole number key in the extent 0, · 1, … , n - 1, called the list of v (or essentially "record v "). In the n x n cluster A , the cell A [ i , j ] holds a referenc e to · the edge object e that runs from the vertex with list i to the vertex with record j , if such edge exists. On the off chance that the edge e is undirected, we store references to e in both A [ i , j ] and A [ j , i ]. In the event that there is no edge from vertex i to vertex j , we store an invalid item in both A [ i , j ] and A [ j , i ].

Slide 60

Data Structure Exercises 20.2

View more...