adjacency and incidence matrix
TRANSCRIPT
![Page 1: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/1.jpg)
CSE 131: DISCRETE MATHEMATICS MS. TASMIA TASRIN ( LECTURER ) Group: Enigma H.M. Rafi Hasan (161-15-7050) Mohammad Touhidul Islam (161-15-7051) Md. Rahmat Ullah (161-15-6970) Abir Hasnat (161-15-6789) Alinewaz Chowdhory (161-15-6790)
![Page 2: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/2.jpg)
PRESENTATION ON Adjacency And Incidence Matrix
![Page 3: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/3.jpg)
WHAT IS GRAPH?
Graph is a set of edges and vertices.
A B
C D
E
![Page 4: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/4.jpg)
REPRESENTING OF GRAPHS
Graph can be represented in the form of matrix.
Different matrix that can be formed are:
1. Adjacency Matrix
2. Incidence Matrix
3. Cut-Set Matrix
4. Circuit Matrix
5. Path Matrix
![Page 5: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/5.jpg)
Adjacency MatrixEdge connected to the vertex is known as incidence edge to that vertex If vertex is connected to itself then vertex is said to be adjacent to itself.If vertex is adjacent then put 1 else 0.Undirected and directed adjacency matrix is different
a
V6
V4
V5V2
V3
h
egc
f
d
V1 a
b
0 000 011 011 011 100 10
0 100 110 00
0 022 10 01
0
V4 V6V5V1 V3V2
V1V2V3V4V5V6
Vertices
Verti
ces
![Page 6: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/6.jpg)
DIRECTED ADJACENCY MATRIX
V6
V4
V5V2
V3
h
egc
f
d
V1a
b
0 000 010 011 001 100 00
0 100 000 00
0 011 10 00
0
V4 V6V5V1 V3V2
V1V2V3V4V5V6
Vertices
Verti
ces
![Page 7: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/7.jpg)
Incidence MatrixEdge connected to the vertex is known as incidence edge to that vertexIf vertex is incident on vertex then put 1 else 0.
V6
V4
V5V2
V3
h
egc
f
d
V1 a
b
VertexV1V2V3V4V5V6
Edgesa, ba, b, c, fc, d, gd, ed, e, f, g, hh
0 000 101 011 010 00
1 011 10 10
1
d fea cb
V4
V1V2V3
g h
0011
0000
Edges
Verte
x
1 110 000 00
0 00V6V5 1
011
![Page 8: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/8.jpg)
APPLICATION OF INCIDENCE AND
ADJACENCY MATRIX
![Page 9: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/9.jpg)
INCIDENCE TO ADJACENCY MATRIX• int m = 4; // number or rows = number of cols• double mat[m][m] = { • {0, 1, 1, 1} , // first point adjacent to all others• {1, 0, 0, 0} , // 2nd only adjacent to 1st• {1, 0, 0, 1} , // 3rd adjacent to 1st & 4th• {1, 0, 1, 0} // 4th adjacent to 1st & 3rd• };• • for(int i=0; i<m-1;++i) • {• for(int j=i+1; j < m; ++i) • { // loop through upper triangle • if( math[i][j] ) • { // if element is set• addPair(i,j); // add it to the list• }• }• }
![Page 10: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/10.jpg)
MAPPING
![Page 11: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/11.jpg)
•Adjacency Lists and average time complexity for binary search
![Page 12: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/12.jpg)
SHORTEST PATH
![Page 13: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/13.jpg)
![Page 14: Adjacency And Incidence Matrix](https://reader031.vdocument.in/reader031/viewer/2022021417/58ec301e1a28ab36188b4659/html5/thumbnails/14.jpg)
GOOGLE SELF-DRIVING CAR