Adjacency And Incidence Matrix
-
Upload
abir-junayed -
Category
Education
-
view
64 -
download
7
Transcript of Adjacency And Incidence Matrix
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)
PRESENTATION ON Adjacency And Incidence Matrix
WHAT IS GRAPH?
Graph is a set of edges and vertices.
A B
C D
E
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
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
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
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
APPLICATION OF INCIDENCE AND
ADJACENCY MATRIX
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• }• }• }
MAPPING
•Adjacency Lists and average time complexity for binary search
SHORTEST PATH
GOOGLE SELF-DRIVING CAR