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 highlight(h,r,'NodeColor','black');
76 end
77end
78
79for r=find(lqn.type==LayeredNetworkElement.ENTRY)'
80 if r>0
81 highlight(h,r,'NodeColor','black');
82 end
83end
84
85mult = nan(lqn.nidx,1);
86mult(1:(lqn.tshift+lqn.ntasks),1)=lqn.mult;
87row = dataTipTextRow('multiplicity',mult);
88h.DataTipTemplate.DataTipRows(2) = row;
89D = 0*lqn.mult;
90for i=1:length(lqn.hostdem)
91 if ~isempty(lqn.hostdem{i})
92 D(i) = lqn.hostdem{i}.getMean;
93 end
94end
95row = dataTipTextRow('hostDemand',D);
96h.DataTipTemplate.DataTipRows(end+1) = row;
97sched = cell(lqn.nidx,1);
98for i=1:length(sched)
99 sched{i} = 'n/a';
100end
101sched(1:(lqn.tshift+lqn.ntasks),1)=lqn.sched;
102row = dataTipTextRow('scheduling',sched);
103h.DataTipTemplate.DataTipRows(end+1) = row;
104end
Definition fjtag.m:157