function BGobj = graphReactions(m)
% function BGobj = graphReactions(m)

% This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative 
% Works 3.0 United States License. To view a copy of this license, visit 
% http://creativecommons.org/licenses/by-nc-nd/3.0/us/ or send a letter to Creative Commons,
% 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

dC       = m.S; 
nR       = size(dC,2);
         
CMatrix    = [zeros(m.nX, m.nX),       dC < 0;
              dC' > 0,           zeros(nR, nR)];

BGobj   = biograph(CMatrix);

for i = 1:m.nX
    node       = BGobj.Nodes(i); 
    node.Size  = [30,50];
    node.Label = char(m.xNames{i});
    node.Shape = 'circle';
end
for i = (m.nX+1):length(BGobj.Nodes)
    node       = BGobj.Nodes(i); 
    node.Size  = [6,6];
    node.Label = 'x';
    node.Shape = 'circle';
    node.Color = [1 0 0];
end

BGobj.LayoutType = 'equilibrium';
BGobj.NodeAutoSize = 'off';
view(BGobj);