Main Content

Determining the Adjacency Matrix for a Model

What Is an Adjacency Matrix?

An adjacency matrix is a square matrix that provides information on reactants and products of reactions in a model. It lets you easily determine:

  • The reactants and products in a specific reaction in a model

  • The reactions that a specific species is part of, and whether the species is a reactant or product in that reaction

An adjacency matrix is an N-by-N matrix, where N equals the total number of species and reactions in a model. Each row corresponds to a species or reaction, and each column corresponds to a species or reaction.

The matrix indicates which species and reactions are involved as reactants and products:

  • Reactants are represented in the matrix with a 1 at the appropriate location (row of species, column of reaction). Reactants appear above the diagonal.

  • Products are represented in the matrix with a 1 at the appropriate location (row of reaction, column of species). Products appear below the diagonal.

  • All other locations in the matrix contain a 0.

For example, if a model object contains one reaction equal to A + B -> C and the Name property of the reaction is R1, the adjacency matrix is:

       A    B    C   R1
  A    0    0    0   1
  B    0    0    0   1
  C    0    0    0   0
  R1   0    0    1   0

Get Adjacency Matrix of SimBiology Model

Load the lotka model.

m1 = sbmlimport("lotka.xml");

Get the adjacency matrix of the model.

[M,Headings] = getadjacencymatrix(m1)
M = 
   (5,1)        1
   (5,2)        1
   (6,3)        1
   (7,4)        1
   (1,5)        1
   (2,5)        1
   (2,6)        1
   (3,6)        1
   (3,7)        1

Headings = 7x1 cell
    {'x'        }
    {'y1'       }
    {'y2'       }
    {'z'        }

See Also

Related Topics