# Data Structures Grap please help

I don't really understand this 1 represent edges and 0 represent no edges Given the below matrix A B C A 0 1 1 B 1 0 0 C 1 0 0 How A is connected to B I see A haven't no edge but B having edge which is 1 I can Agree that both B and C are connecting because both have 1s can someone please explain

2/24/2022 3:00:56 AM

Sir.George S Mulbah II11 Answers

New AnswerThe row is the source, the column is the destination (doesn't really matter that much because the graph is undirected), From node A (row A) there is an edge to B (col B) and an edge to C (col C), because G(A,B) = 1. Also, G(A,C) = 1, so there is an edge from A to C. The graph being undirected (the matrix is symmetric), G(B,A) = 1 and G(C,A) =1. All other entries are 0. Thus, those are the only edges. C ---- A ---- B, is the graph represented by your matrix.

Thank you π I now get it A is connected to C at row A column C and also at row C column A right

Right :) Usually, the direction is from row to column. So, a 1 in row A and column C means an edge from A to C. Since the graph is undirected, there is also a 1 in row C and column A, that is, an edge from C back to A.

After reading a blog I now understand it adjacent vertices. Two vertices is said to be adjacent or neighbor if it support at least one common edge So (a,b) = 1 has be (b,a )= 1 So the Above matrix A has 0 but B has 1 so therefore they are connect even though A has 0 more like Facebook if you confirm a friend request you guys are automatically friendly no need for the other person that you confirm to confirm you back , it said to be undirected. But on Instagram if you follow some one they need to follow you back too so the graph is directed The graph for this matrix is (A,B)(B,A) =1 so we take (A,B) A--B | C The edges is four in this Graph

Not quite. There are only three vertices, A, B, and C. Two edge, one connecting A and B, one connecting A and C: A / \ B C

Ani Jona π I now understand so there is no need writing a edge from A to B since G(A,B) = 1 and G(A,C) = 1 A --- C

No, 1 means the is an edge. The matrix shows adjacent vertices. If an entry G(i, j) is one, then it means there is an edge from vertex i to vertex j. Your matrix has (modulo symmetry) two edges, G(A,B) and G(A,C), as those matrix elements are 1, the others are zero. In particular, G(B,C)=0, hence no edge between B and C.