10.09.2013 Views

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />

These are :<br />

<strong>1.</strong> Adjacent matrix<br />

2. Adjacency list representation<br />

3. Multi list representation<br />

ADJACENT MATRIX:<br />

The adjacency matrix A for a graph G=(v,e) with n vertices , is an nxn matrix of<br />

bits such that Aij=1,if there is an edge from Vi to Vj & Aij=0,if there is no such<br />

edge .For undirected :as shown in<br />

fig<br />

1 2 3 4 5 6<br />

I \ j<br />

1 0 1 0 0 0 0<br />

2 1 1 1 0 0 0<br />

3 0 1 0 1 1 1<br />

4 0 0 1 0 0 0<br />

5 0 0 1 0 0 0<br />

6 0 0 1 0 0 0<br />

Fig:e<br />

The adjacency matrix for the undirected graph is shown in fig E.<br />

For directed graph: An edge of a directed graph has its source in one node and<br />

terminates in another nodes .By convection (Vi,Vj) denotes direction for node Vi<br />

to nodeVj.<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 78 ‐

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!