graph - Matlab SimBiology - Allow self connecting nodes -
i'm using matlab's simbiology tool box generate biograph (which are, graphs).
when i'm trying include node connects itself, e.g:
g = [ 0 1 0; 1 0 1; 0 0 1; % 1 connects itself. ]
i following warning message :
warning: self connecting nodes not allowed, ignoring diagonal of cm.
as data sets include self connecting nodes, wondering if configurable feature.
thanks!
unfortunately biograph can not have self-connecting edges. if purpose visualization add nodes empty labels. here example small graph , 2 self-connecting nodes:
cm = [0 1 1 0 0;1 0 0 1 1;1 0 1 0 0;0 0 0 0 1;1 0 1 0 1]; ids = {'m30931','l07625','k03454','m27323','m15390'}; sc = find(diag(cm)); cm = cm-diag(diag(cm)); n = size(cm,1); m = numel(sc); cm(n+m,n+m)=0; cm(sub2ind([n+m,n+m],[sc;(1:m)'+n],[(1:m)'+n;sc]))=1; ids((1:m)+n) = {' '}; bg = biograph(cm); = 1:numel(bg.nodes) bg.nodes(i).label = ids{i}; if i>n bg.nodes(i).shape = 'circle'; end end view(bg)
hth lucio
Comments
Post a Comment