LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
plotGraphSimple.m
1function plotGraphSimple(self, method)
2% PLOTGRAPHSIMPLE(SELF, METHOD)
3%
4% Plot graph without colors, suitable for inclusion in scientific papers
5% METHOD: hashnames, names, hashids, ids
6
7% Copyright (c) 2012-2026, Imperial College London
8% All rights reserved.
9
10if nargin<2 %~exist('useNodes','var')
11 method = 'nodes';
12end
13
14lqn = self.getStruct;
15T = lqn.graph;
16figure;
17switch method
18 case {'nodes','hashnames'}
19 lqn.hashnames = strrep(lqn.hashnames,'\_','_'); % remove escaping if it exists
20 lqn.hashnames = strrep(lqn.hashnames,'_','\_'); % reapply it include to those which did not have it
21 h = plot(digraph(T),'Layout','layered','NodeLabel',lqn.hashnames);
22 case 'names'
23 lqn.names = strrep(lqn.names,'\_','_'); % remove escaping if it exists
24 lqn.names = strrep(lqn.names,'_','\_'); % reapply it include to those which did not have it
25 h = plot(digraph(T),'Layout','layered','NodeLabel',lqn.names);
26 case 'ids'
27 h = plot(digraph(T),'Layout','layered');
28 case 'hashids'
29 hashids = lqn.hashnames;
30 for i=1:length(lqn.hashnames)
31 hashids{i} = [lqn.hashnames{i}(1:2),num2str(i)];
32 end
33 h = plot(digraph(T),'Layout','layered','NodeLabel',hashids);
34end
35title(['Model: ',self.name]);
36
37%for r=find(lqnGraph.Edges.Pre==1)' %AndFork
38% highlight(h,lqnGraph.Edges.EndNodes(r,:),'EdgeColor','m')
39%end
40%for r=find(lqnGraph.Edges.Post==1)' % AndJoin
41% highlight(h,lqnGraph.Edges.EndNodes(r,:),'EdgeColor','m')
42%end
43
44for r=find(lqn.type==LayeredNetworkElement.HOST)'
45 if r>0
46 highlight(h,r,'NodeColor','black');
47 end
48end
49
50for r=find(lqn.type==LayeredNetworkElement.ACTIVITY)'
51 if r>0
52 highlight(h,r,'NodeColor','black');
53 end
54end
55
56for r=find(lqn.type==LayeredNetworkElement.ACTIVITY)'
57 p = find(lqn.graph(:,r))';
58 if r>0
59 switch lqn.actpretype(r)
60 case ActivityPrecedenceType.PRE_AND
61 % highlight(h,p,'Marker','o');
62 end
63 end
64 p = find(lqn.graph(r,:))';
65 if r>0
66 switch lqn.actposttype(r)
67 case ActivityPrecedenceType.POST_AND
68 % highlight(h,p,'Marker','o');
69 end
70 end
71end
72
73for r=find(lqn.type==LayeredNetworkElement.TASK)'
74 if r>0
75 if lqn.isref(r)
76 highlight(h,r,'NodeColor','black');
77 else
78 highlight(h,r,'NodeColor','black');
79 end
80 end
81end
82
83for r=find(lqn.type==LayeredNetworkElement.ENTRY)'
84 if r>0
85 highlight(h,r,'NodeColor','black');
86 end
87end
88
89mult = nan(lqn.nidx,1);
90mult(1:(lqn.tshift+lqn.ntasks),1)=lqn.mult;
91row = dataTipTextRow('multiplicity',mult);
92h.DataTipTemplate.DataTipRows(2) = row;
93D = 0*lqn.mult;
94for i=1:length(lqn.hostdem)
95 if ~isempty(lqn.hostdem{i})
96 D(i) = lqn.hostdem{i}.getMean;
97 end
98end
99row = dataTipTextRow('hostDemand',D);
100h.DataTipTemplate.DataTipRows(end+1) = row;
101sched = cell(lqn.nidx,1);
102for i=1:length(sched)
103 sched{i} = 'n/a';
104end
105sched(1:(lqn.tshift+lqn.ntasks),1)=lqn.sched;
106row = dataTipTextRow('scheduling',sched);
107h.DataTipTemplate.DataTipRows(end+1) = row;
108end
Definition mmt.m:92