+ 1

Adjacency Matrix

Can someone try and explain for me how this applies in graphs. Thanks 🙏🏽

27th Oct 2018, 7:38 AM
Romo
Romo - avatar
6 Respostas
+ 2
Edges go between 2 vertices. Say you have a graph that looks like a -> b -> c You could store the edges in a list of pairs, like [(a, b), (b, c)]. And that's your adjacency list. Another way to do it is to make a table where you mark what is connected to what, like a b c a X X b X X c X (a->a is assumed to be true here) Now replaces all Xs with 1 and the others with 0. Your adjacency matrix is 1,1,0, 0,1,1, 0,0,1
27th Oct 2018, 7:49 AM
Schindlabua
Schindlabua - avatar
+ 1
Of course they are, but I'm talking about consistency. Your "diagram" and adjacency list didn't have them.
27th Oct 2018, 12:27 PM
Kishalaya Saha
Kishalaya Saha - avatar
0
Schindlabua nicely explained. But those three 1s along the diagonal correspond to loops (edge connecting a vertex to itself). So they shouldn't really be there.
27th Oct 2018, 9:46 AM
Kishalaya Saha
Kishalaya Saha - avatar
0
Depends on your graph. Loops in a graph are fine!
27th Oct 2018, 12:18 PM
Schindlabua
Schindlabua - avatar
0
Yeah, good point!
27th Oct 2018, 1:16 PM
Schindlabua
Schindlabua - avatar
0
thank you man!!!
28th Oct 2018, 9:45 AM
Romo
Romo - avatar