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