I'm sort of new to Mathematica and have been working on a project that involves simulating newtwork changes in the form of matrices. I have the following lines of code:
k = 10; m = 10; m1 = SparseArray[_ :> RandomInteger[1], {k, m}]; A = UpperTriangularize[m1] + Transpose[UpperTriangularize[m1, 1]]; MatrixForm[A]; aa = MatrixForm[A, TableHeadings -> {{"A1", "A2", "A3", "A4", "A5", "V1", "V2", "V3", "V4", "V5"}, {"A1", "A2", "A3", "A4", "A5", "V1", "V2", "V3", "V4", "V5"}}] This creates a "randomly" generated matrix consisting of elements 1 or 0.
I have included a picture to help explain my question. It's just a randomly generated matrix from the code above but it would be easier to see visualize the next part if I included colors.
I'm trying to create a SINGLE adjacency graph which shows the relationships between A-A (blue), A-V (pink), and V-V (red). The V-A connection shown in black is just the transpose of the pink quadrant and is unnecessary for me to show. The headings of A and V just represent different molecules. The matrix elements indicate where there is an edge between two molecules. A 1 means there is an edge, a 0 means no edge. As an example A1-A1 has a 0 as its element, therefore there is no edge.
What I managed to do so far is create two adjacency matrices, one for the A-A interactions and one of the V-V interactions. That is represented by the code below. The quadrants are in reference to the same found in a Cartesian coordinate graph (Top right = 1, then go counter clockwise for the other quadrants).
(*Pulls out the submatrix in Q1 *) sm1 = A[[1 ;; 5, 6 ;; 10]]; ns1 = Normal[sm1] (*Pull out the submatrix in Q2*) sm2 = A[[1 ;; 5, 1 ;; 5]]; ns2 = Normal[sm2] (*Pulls out the submatrix in Q4*) sm3 = A[[6 ;; 10, 6 ;; 10]]; ns3 = Normal[sm3] (*Vertex Labels*) vlabel2 = {A1, A2, A3, A4, A5}; vlabel3 = {V1, V2, V3, V4, V5}; {g2, g3} = (AdjacencyGraph @@@ {{vlabel2, ns2}, {vlabel3, ns3}}) Row[Labeled[ SetProperty[#, {VertexShapeFunction -> "Name", ImageSize -> 200}], #2, Top] & @@@ {{g2, "g2"}, {g3, "g3"}}] The above code generates two adjacency matrices, one for the A-A interactions (blue region) and one for the V-V interactions (red region). In included how to pull out the submatrix for Q1 since I think that would be necessary in helping me solve my problem. The main issue I'm having is incorporating the V-A interactions (pink region). I'm lost as to how I would go about incorporating the third adjacency matrix in order to connect the two that I currently have.
Any help would be greatly appreciate!




