getadjacencymatrix
Get adjacency matrix from model object
The order of species in the output arguments (M and
Headings) matches the order of species returned by
modelObj.Species.
Syntax
M = getadjacencymatrix(modelObj)
[M, Headings]
= getadjacencymatrix(modelObj)
[M, Headings, Mask]
= getadjacencymatrix(modelObj)
Arguments
M | Adjacency matrix for |
modelObj | Specify the |
Headings | Return row and column headings. If species are in multiple
compartments, species names are qualified with the compartment name in the form
|
Mask | Return |
Description
returns an adjacency matrix (M = getadjacencymatrix(modelObj)M) for the model object
(modelObj).
An adjacency matrix is defined by listing all species contained by
modelObj and all reactions contained by modelObj
column-wise and row-wise in a matrix. The reactants of the reactions are represented in the
matrix with a 1 at the location of [row of species, column of reaction]. The products of the
reactions are represented in the matrix with a 1 at the location of [row of reaction, column
of species]. All other locations in the matrix are 0.
[ returns the adjacency matrix to
M, Headings]
= getadjacencymatrix(modelObj)M and the row and column headings to Headings.
Headings is defined by listing all Name property
values of species contained by modelObj and all Name
property values of reactions contained by modelObj.
[ returns an array of 1s and 0s to
M, Headings, Mask]
= getadjacencymatrix(modelObj)Mask, where a 1 represents a species object and a 0 represents a
reaction object.
Examples
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 = 7×7 sparse double matrix (9 nonzeros)
(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 = 7×1 cell
{'x' }
{'y1' }
{'y2' }
{'z' }
{'Reaction1'}
{'Reaction2'}
{'Reaction3'}