Skip to content

Instantly share code, notes, and snippets.

@gobengo
Created January 21, 2011 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gobengo/789318 to your computer and use it in GitHub Desktop.
Save gobengo/789318 to your computer and use it in GitHub Desktop.
Check it out
Imagine graph G with vertexes A, B, C (sketch this if that's your thing). G has the following directed edges:
A->B
B->C
C->A
Basically this is a triangle with a loop. Now, let's say we model this with a binary matrix. Edge A->B means that G[A][B]=1. Similarly: G[B][C], G[C][A] = 1, 1. Think about this 2D array as a matrix G1:
ABC
A010
B001
C100
Pretty slick. But hey, what if it was an undirected graph? So that any connection A->B implies B->A? B<->A, if you will. Then you'd get G2:
ABC
A010
B101
C010
Note that this is a symmetric graph (across the NW->SE axes). This is special, because the Transpose of the graph is the same graph. A somewhat intuitive theorem is:
All directed graphs, when represented as matricies as above, correspond to a symmetric matrix.
Furthermore, I feel like there's something special about the relation of G1 and G2. I'm doing more testing and researching now.
For some reason this reminds me of the Linear Algebra class I never went to in college. That prof was a baller...
@gobengo
Copy link
Author

gobengo commented Jan 21, 2011

Oh, and think about if it wasn't a binary matrix, but instead a value between 0-1, even irrational expressions. These could represent weights on the graph. Sick. Let's go make some neural net matrix calculations in JavaScript!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment