Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

611093 views
1
% This file was created automatically from posetops.msk.
2
% DO NOT EDIT!
3
\Chapter{Graphic Posets}
4
5
This chapter describes the part of {\XGAP} that allows the user to
6
conveniently display posets graphically.
7
8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
\Section{Introduction}
10
11
A poset is just a partially ordered set. To display posets
12
reasonably in a generic way we need additional structure. So for {\XGAP} a
13
poset comes in so called levels. At all times in the life of a graphic
14
poset there are only finitely many levels and they are totally ordered,
15
that is for two levels we can always say, which one is ``higher''. The
16
position within the graphic sheet reflects this ordering.
17
18
The levels are parametrized by ``level parameters'', which can be any
19
{\GAP} object but must be unique within a graphic poset. A level is always
20
accessed by its level parameter and *not* by its number!
21
22
The vertices in each level are grouped into classes. For example for
23
graphic subgroup lattices vertices in the same class correspond to conjugate
24
subgroups, vertices in the same level have the same size or index in the
25
whole group. The classes within each level are parametrized by ``class
26
parameters'', which can be any {\GAP} object but must be unique within a
27
level. A class within a level is always accessed by its class parameter and
28
*not* by its number!
29
30
The user must supply a *partial order* for all of his levels. The mechanism
31
to achieve this is the operation `CompareLevels', which compares two level
32
parameters. The current *total order* of the levels is always a refinement
33
of the partial order. The user can permute levels, if that does not
34
contradict the partial order defined by `CompareLevels'.
35
36
A vertex in the poset that is ``contained in'' another vertex in the poset
37
order (we speak of ``inclusion'' like in the case of subgroup lattices)
38
must always be in a level that is lower on the screen, because there
39
is only a connecting line representing the inclusion. This is achieved by
40
the fact, that inclusions of vertices are communicated to {\XGAP} just by
41
creating an ``edge'' between them. This means, that the vertex in the
42
``lower'' level lies in the vertex in the ``higher'' level. There must not
43
be edges between vertices in the same level!
44
45
The terminology ``vertices'' and ``edges'' comes from the fact, that a
46
graphic poset is just a special case of a graphic graph, where vertices can
47
be placed anywhere in the sheet and edges have nothing to do with
48
inclusion. It is planned that also a graphic graph library is implemented
49
in {\XGAP} but it is not yet operational. However everything which could be
50
done not only for posets but at the same time for graphs is implemented
51
already within the poset package. This explains the usage of ``graph'' in
52
many places where you would otherwise expect ``poset''.
53
54
What you have to do to use the graphic poset package is create a graphic
55
poset (a special instance of a graphic sheet), create some levels and
56
perhaps classes within them. Then you can create vertices and edges, to
57
encode the ordering. Everything else is done by the library. See the next
58
section for details about the available operations.
59
60
Note that we chose a functional approach for certain decision
61
procedures. This means that for example if you create a vertex and do not
62
specify a position, an operation (`ChoosePosition') is called to determine
63
the actual position. You can use the generic routines or install your own
64
methods for all of those decisions. In this case you just set a new filter
65
for your posets and overload the generic methods by special routines for
66
objects with your new filter set. You can see this approach in the example
67
in "An Example".
68
69
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70
\Section{Operations}
71
72
*Constructors:*
73
74
\medskip%
75
\>GraphicPoset( <name>, <width>, <height> ) O
76
77
creates a new graphic poset which is a specialization of a graphic graph
78
mainly because per definition a poset comes in ``levels'' or ``layers''.
79
This leads to some algorithms that are more efficient than the general
80
ones for graphs.
81
82
83
\>CreateLevel( <poset>, <levelparam> ) O
84
\>CreateLevel( <poset>, <levelparam>, <lptext> ) O
85
86
A level in a graphic poset can be thought of as a horizontal slice of
87
the poset. It has a y coordinate of the top of the level relatively to
88
the graphic sheet and a height. Every class of vertices in a graphic
89
poset is in a level. The levels are totally ordered by their y
90
coordinate. No two vertices which are included in each other are in the
91
same level. A vertex containing another one is always ``higher'' on the
92
screen, meaning in a ``higher'' level. Every level has a unique level
93
parameter, which can be any {\GAP} object. The user is responsible for all
94
methods where a level parameter occurs as parameter and is not just an
95
integer. There is NO {\GAP} object representing a level which is visible
96
for the user of posets. All communication about levels goes via the
97
level parameter. `CreateLevel' creates a new level with level parameter
98
<levelparam> in the graphic poset <poset>. It returns `fail' if there
99
is already a level with a level parameter which is considered ``equal''
100
to <levelparam> by `CompareLevels' or <levelparam> if everything went
101
well.
102
103
The second method allows to specify which text appears for the level at
104
the right edge of the sheet.
105
106
107
\>CreateClass( <poset>, <levelparam>, <classparam> ) O
108
109
A class in a graphic poset is a collection of vertices within a level
110
which belong together in some sense. Every vertex in a graphic poset
111
is in a class, which in turn belongs to a level. Every class in a level
112
has a unique class parameter, which can be any {\GAP} object. The user is
113
responsible for all methods where a class parameter occurs as parameter
114
and is not just an integer. There is NO {\GAP} object representing a class
115
which is visible to the user of posets. All communication about classes
116
goes via the class parameter. `CreateClass' creates a new class in the
117
level with level parameter <levelparam> in the graphic poset
118
<poset>. It returns `fail' if there is no level with level parameter
119
<levelparam> or there is already a class in this level with class
120
parameter <classparam>. `CreateClass' returns <classparam> otherwise.
121
122
123
\>`Vertex( <graph>, <data>[, <inf>] )'{Vertex![poset]}@{`Vertex'!`[poset]'} O
124
125
Creates a new vertex. <inf> is a record in which additional info can be
126
supplied for the new vertex. For general graphic graphs only the
127
`label', `color', `shape', `x' and `y' components are applicable, they
128
contain a short label which will be attached to the vertex, the color,
129
the shape (`circle', `diamond', or `rectangle') and the coordinates
130
relative to the graphic sheet respectively. For graphic posets also the
131
components `levelparam' and `classparam' are evaluated. If the component
132
`hints' is bound in <inf> it must be a list of x coordinates which will be
133
delivered to `ChoosePosition' to help placement. Those x coordinates will
134
be the coordinates of other vertices related to the new one. All values of
135
record components which are not specified will be determined by calling
136
some methods for graphic graphs or posets. Those are:
137
`ChooseLabel' for the label,
138
`ChooseColor' for the color,
139
`ChooseShape' for the shape,
140
`ChoosePosition' for the position,
141
`ChooseLevel' for the level parameter,
142
`ChooseClass' for the class parameter, and
143
`ChooseWidth' for the line width of the vertex.
144
`Vertex' returns `fail' if no vertex was created. This happens only, if
145
one of the choose functions return `fail' or no possible value, for
146
example a non-existing level or class parameter. `Vertex' returns a
147
vertex object if everything went well.
148
149
150
\>Edge( <graph>, <vertex1>, <vertex2> ) O
151
\>Edge( <graph>, <vertex1>, <vertex2>, <defaults> ) O
152
153
Adds a new edge from <vertex1> to <vertex2>. For posets this puts one
154
of the vertices into the other as a maximal subvertex. So either
155
<vertex1> must lie in a ``higher'' level than <vertex2> or the other way
156
round. There must be no vertex ``between'' <vertex1> and <vertex2>. If
157
the two vertices are in the same level or one is already indirectly
158
included in the other `fail' is returned, otherwise `true'. That means,
159
that in the case where one of the two vertices is already a maximal
160
subobject of the other, then the method does nothing and returns `true'.
161
The variation with a <defaults> record just hands this over to the lower
162
levels, meaning that the line width and color are modified.
163
164
165
166
*Destructors:*
167
168
\medskip%
169
\>Delete( <poset>, <vertex1>, <vertex2> )!{for edge in poset}
170
\>Delete( <poset>, <vertex1>)!{for vertex in poset}
171
\>Delete( <poset>, <levelparam>, <classparam> )!{for class in poset}
172
173
These three variants of the `Delete' operation delete an edge, a vertex and
174
a class respectively.
175
176
\>DeleteLevel( <poset>, <levelparam> ) O
177
178
The following method applies to a level. It returns `fail' if no level
179
with level parameter <levelparam> is in the poset. Otherwise the level
180
is deleted and all classes within it are also deleted! `DeleteLevel'
181
returns `true' if the level is successfully deleted.
182
183
184
185
\medskip%
186
*Operations to change a poset:*
187
\medskip%
188
\>ResizeLevel( <poset>, <levelparam>, <height> ) O
189
190
Changes the height of a level. The y coordinate can only be changed by
191
permuting levels, see below.
192
Attention: This can increase the size of the sheet!
193
Returns `fail' if no level with level parameter <levelparam> exists and
194
`true' otherwise.
195
196
197
\>MoveLevel( <poset>, <levelparam>, <position> ) O
198
199
Moves a level to another position. <position> is an absolute index in
200
the list of levels. The level with level parameter <levelparam> will be
201
at the position <position> after the operation. This is only allowed if
202
the new ordering is compatible with the partial order given by
203
`CompareLevels' and if there is no connection of a vertex in the moving
204
level with another level with which it is interchanged. So
205
<levelparam> is compared with all level parameters between the old and
206
the new position. If there is a contradiction, nothing happens and the
207
method returns `fail'. If everything works the operation returns
208
`true'.
209
210
211
\>`Relabel( <graph>, <vertex>, <label> )'{Relabel![poset]}@{`Relabel'!`[poset]'} O
212
\>`Relabel( <graph>, <vertex> )'{Relabel![poset]}@{`Relabel'!`[poset]'} O
213
\>`Relabel( <poset>, <vertex1>, <vertex2>, <label> )'{Relabel![poset]}@{`Relabel'!`[poset]'} O
214
\>`Relabel( <poset>, <vertex1>, <vertex2> )'{Relabel![poset]}@{`Relabel'!`[poset]'} O
215
216
Changes the label of the vertex <vertex> or the edge between <vertex1>
217
and <vertex2>. This must be a short string. In the method where no
218
label is specified the new label is chosen functionally: the operation
219
`ChooseLabel' is called. Returns `fail' if an error occurs and `true'
220
otherwise. This operation already exists in {\XGAP} for graphic
221
objects.
222
223
224
\>`Move( <graph>, <vertex>, <x>, <y> )'{Move![poset]}@{`Move'!`[poset]'} O
225
\>`Move( <graph>, <vertex> )'{Move![poset]}@{`Move'!`[poset]'} O
226
227
Moves vertex <vertex>. For posets coordinates are relative to the level
228
of the vertex. <vertex> must be a vertex object in <graph>. If no
229
coordinates are specified the operation `ChoosePosition' is
230
called. `Move' returns `fail' if an error occurs and `true' otherwise.
231
This operation already exists in {\XGAP} for graphic objects.
232
233
234
\>`Reshape( <graph>, <vertex> )'{Reshape![poset]}@{`Reshape'!`[poset]'} O
235
\>`Reshape( <graph>, <vertex>, <shape> )'{Reshape![poset]}@{`Reshape'!`[poset]'} O
236
237
Changes the shape of the vertex <vertex>. <vertex> must be a vertex
238
object in the graph or poset <graph>. For the method where no shape is
239
specified the new shape is chosen functionally: `ChooseShape' is called
240
for the corresponding data. `Reshape' returns `fail' if an error
241
occurs and `true' otherwise. This operation already exists in {\XGAP}
242
for graphic objects.
243
244
245
\>`Recolor( <graph>, <vertex> )'{Recolor![poset]}@{`Recolor'!`[poset]'} O
246
\>`Recolor( <graph>, <vertex>, <color> )'{Recolor![poset]}@{`Recolor'!`[poset]'} O
247
\>`Recolor( <poset>, <vertex1>, <vertex2>, <color> )'{Recolor![poset]}@{`Recolor'!`[poset]'} O
248
\>`Recolor( <poset>, <vertex1>, <vertex2> )'{Recolor![poset]}@{`Recolor'!`[poset]'} O
249
250
Changes the color of the vertex <vertex> or the edge between <vertex1>
251
and <vertex2>. <vertex> must be a vertex object in <graph>. For the
252
method where no color is specified the new color is chosen
253
functionally: `ChooseColor' is called for the corresponding
254
data. `Recolor' returns `fail' if an error occurs and `true'
255
otherwise. This operation already exists in {\XGAP} for graphic objects.
256
257
258
\>`SetWidth( <graph>, <vertex1>, <vertex2>, <width> )'{SetWidth![poset]}@{`SetWidth'!`[poset]'} O
259
\>`SetWidth( <graph>, <vertex1>, <vertex2> )'{SetWidth![poset]}@{`SetWidth'!`[poset]'} O
260
261
Changes the line width of an edge. <vertex1> and <vertex2> must be
262
vertices in the graph <graph>. For the method where no line width is
263
specified the width is chosen functionally: `ChooseWidth' is called for
264
the corresponding data pair. Returns `fail' if an error occurs and
265
`true' otherwise. This operation already exists in {\XGAP} for graphic
266
objects.
267
268
269
\>`Highlight( <graph>, <vertex> )'{Highlight![poset]}@{`Highlight'!`[poset]'} O
270
\>`Highlight( <graph>, <vertex>, <flag> )'{Highlight![poset]}@{`Highlight'!`[poset]'} O
271
272
Changes the highlighting status of the vertex <vertex>. <vertex> must
273
be a vertex object in <graph>. For the method where no flag is
274
specified the new status is chosen functionally: `ChooseHighlight' is
275
called for the corresponding data. Returns `fail' if an error occurs
276
and `true' otherwise. This operation already exists in {\XGAP} for
277
graphic objects.
278
279
280
\>Select( <graph>, <vertex>, <flag> ) O
281
\>Select( <graph>, <vertex> ) O
282
283
Changes the selection state of the vertex <vertex>. <vertex> must be a
284
vertex object in <graph>. The flag determines whether the vertex
285
should be selected or deselected. This operation already exists in
286
{\XGAP} for graphic objects. The method without flags assumes `true'.
287
288
289
\>DeselectAll( <graph> ) O
290
291
Deselects all vertices in the graph or poset <graph>.
292
293
294
\>Selected( <graph> ) O
295
296
Returns a (shallow-)copy of the set of all selected vertices.
297
298
299
300
\medskip%
301
*Operations for decisions:*
302
\medskip%
303
\>ChooseLabel( <graph>, <data> ) O
304
\>ChooseLabel( <graph>, <data>, <data> ) O
305
306
This operation is called during vertex or edge creation, if the caller
307
didn't specify a label for the vertex or edge. It has to return a short
308
string which will be attached to the vertex. If it returns `fail' the
309
new vertex is not generated! The generic method just returns the empty
310
string, so no label is generated. This method is also called in the
311
`Relabel' method without label parameter.
312
313
314
\>ChooseLevel( <poset>, <data> ) O
315
316
This operation is called during vertex creation, if the caller didn't
317
specify a level to which the vertex belongs. It has to return a level
318
parameter which exists in the poset. If it returns `fail' the new
319
vertex is not generated!
320
321
322
\>ChooseClass( <poset>, <data>, <levelparam> ) O
323
324
This operation is called during vertex creation, if the caller didn't
325
specify a class to which the vertex belongs. It has to return a
326
class parameter which exists in the poset in the level with parameter
327
<levelparam>. If it returns `fail' the new vertex is not generated!
328
329
330
\>ChooseColor( <graph>, <data> ) O
331
\>ChooseColor( <graph>, <data1>, <data2> ) O
332
333
This operation is called during vertex or edge creation. It has to return a
334
color. If it returns `fail' the new vertex is not generated!
335
It is also called in the `Recolor' method without color parameter.
336
337
338
\>ChooseHighlight( <graph>, <data> ) O
339
340
This operation is called during vertex creation. It has to return a
341
flag which indicates, whether the vertex is highlighted or not. If it
342
returns `fail' the new vertex is not generated!
343
It is also called in the `Highlight' method without flag parameter.
344
345
346
\>ChoosePosition( <poset>, <data>, <levelparam>, <classparam>, <hints> ) O
347
\>ChoosePosition( <graph>, <data> ) O
348
349
This operation is called during vertex creation. It has to return a
350
list with two integers: the coordinates. For posets those are relative
351
to the level the vertex resides in. If it returns `fail' the new
352
vertex is not generated! The parameters <levelparam> and <classparam>
353
are level and class parameters respectively.
354
355
356
\>ChooseShape( <graph>, <data> ) O
357
358
This operation is called during vertex creation.
359
It has to return a string out of the following list:
360
`circle', `diamond', `rectangle'.
361
If it returns `fail' the new vertex is not generated!
362
363
364
\>ChooseWidth( <graph>, <data> ) O
365
\>ChooseWidth( <graph>, <data1>, <data2> ) O
366
367
This operation is called during vertex or edge creation.
368
It has to return a line width.
369
If it returns `fail' the new vertex or edge is not generated!
370
This is also called by the `SetWidth' operation without width parameter.
371
372
373
\>CompareLevels( <poset>, <levelparam1>, <levelparam2> ) O
374
375
376
Compare two level parameters. -1 means that the level with parameter
377
<levelparam1> is ``higher'', 1 means that the one with parameter
378
<levelparam2> is ``higher'', 0 means that they are equal. `fail' means
379
that they are not comparable.
380
381
382
383
\medskip%
384
*Operations to get information:*
385
\medskip%
386
\>WhichLevel( <poset>, <y> ) O
387
388
Determines the level in which position <y> is. `WhichLevel' returns the
389
level parameter or `fail'.
390
391
392
\>WhichClass( <poset>, <x>, <y> ) O
393
394
Determines a class with a vertex which contains the position
395
$(<x>,<y>)$. The first class found is taken. `WhichClass' returns a
396
list with the level parameter as first and the class parameter as
397
second element. `WhichClass' returns `fail' if no such class is found.
398
399
400
\>WhichVertex( <graph>, <x>, <y> ) O
401
\>WhichVertex( <graph>, <data> ) O
402
\>WhichVertex( <graph>, <data>, <func> ) O
403
404
Determines a vertex which contains the position $(<x>,<y>)$.
405
`WhichVertex' returns a vertex. In the third form the function <func>
406
must take two parameters <data> and the data entry of a vertex in
407
question. It must return `true' or `false', according to the right
408
vertex being found or not. The function can for example consider just
409
one record component of data records. `WhichVertex' returns `fail' in
410
case no vertex is found.
411
412
413
\>WhichVertices( <graph>, <x>, <y> ) O
414
\>WhichVertices( <graph>, <data> ) O
415
\>WhichVertices( <graph>, <data>, <func> ) O
416
417
Determines the list of vertices which contain the position
418
$(<x>,<y>)$. `WhichVertices' returns a list.
419
In the third form the function <func> must take two parameters <data> and
420
the data entry of a vertex in question. It must return `true' or `false',
421
according to the vertex belonging into the result or not.
422
The function can for example consider just one record component of
423
data records.
424
Returns the empty list in case no vertex is found.
425
426
427
\>Levels( <poset> ) O
428
429
Returns the list of level parameters in descending order meaning
430
highest to lowest.
431
432
433
\>Classes( <poset>, <levelparam> ) O
434
435
Returns the list of class parameters in the level with parameter
436
<levelparam>. `Classes' Returns `fail' if no level with parameter
437
<levelparam> exists.
438
439
440
\>Vertices( <poset>, <levelparam>, <classparam> ) O
441
442
Returns the list of vertices in the class with parameter <classparam>
443
in the level with parameter <levelparam>. Returns `fail' if no level
444
with parameter <levelparam> or no class with parameter <classparam>
445
exists in the level.
446
447
448
\>Maximals( <poset>, <vertex> ) O
449
450
Returns the list of maximal subvertices in <vertex>.
451
452
453
\>MaximalIn( <poset>, <vertex> ) O
454
455
Returns the list of vertices, in which <vertex> is maximal.
456
457
458
\>PositionLevel( <poset>, <levelparam> ) O
459
460
Returns the y position of the level relative to the graphic
461
sheet and the height. Returns `fail' if no level with parameter
462
<levelparam> exists.
463
464
465
466
\medskip%
467
*Operations for user communication:*
468
\medskip%
469
\>`Menu( <graph>, <title>, <entrylist>, <typelist>, <functionslist> )'{Menu![poset]}@{`Menu'!`[poset]'} O
470
471
This operation already exists in {\XGAP} for graphic sheets.
472
Builds a new menu with title <title> but with information about the
473
type of the menu entry.
474
This information describes the relation between the selection state of
475
the vertices and the parameters supplied to the functions. It is stored
476
in the list <typelist>, which consists of strings. The following
477
types are supported:
478
\beginitems
479
`forany' & always enabled, generic routines don't change anything
480
481
`forone' & enabled iff exactly one vertex is selected
482
483
`fortwo' & enabled iff exactly two vertices are selected
484
485
`forthree'& enabled iff exactly three vertices are selected
486
487
`forsubset'&enabled iff at least one vertex is selected
488
489
`foredge' & enabled iff a connected pair of two vertices is selected
490
491
`formin2' & enabled iff at least two vertices are selected
492
493
`formin3' & enabled iff at least three vertices are selected
494
495
\enditems
496
497
<entrylist> and <functionslist> are like in the original operation for
498
graphic sheets.
499
The `IsMenu' object is returned. It is also stored in the sheet.
500
501
502
\>ModifyEnabled( <graph>, <from>, <to> ) O
503
504
Modifies the ``Enabledness'' of menu entries according to their type and
505
number of selected vertices. This operation works on all menu entries
506
of some menus: <from> is the first menu to work on and
507
<to> the last one (indices). Only menus with the property `IsAlive' are
508
considered. `ModifyEnabled' returns nothing.
509
510
511
\>InstallPopup( <graph>, <func> ) O
512
513
Installs a function that is called if the user clicks with the right
514
button on a vertex. The function gets as parameters:
515
<poset>,<vertex>,<x>,<y> (click position)
516
517
518
\>PosetLeftClick( <poset>, <x>, <y> ) O
519
520
This operation is called when the user does a left click in the poset
521
<poset>. The current pointer position is supplied in the parameters <x>
522
and <y>. The generic method for `PosetLeftClick' lets the user move,
523
select and deselect vertices or edges. An edge is selected as pair of
524
vertices.
525
526
527
\>PosetCtrlLeftClick( <poset>, <x>, <y> ) O
528
529
530
This operation is called when the user does a left click in a poset
531
<poset> while holding down the control key. The current pointer
532
position is supplied in the parameters <x> and <y>. The generic method
533
for `PosetCtrlLeftClick' lets the user move, select and deselect
534
vertices or edges. The difference to the operation without the control
535
key is, that while selecting the old vertices are NOT deselected.
536
Moving does not move the whole class but only one vertex. This allows
537
for permuting the vertices within a class. An edge is selected as pair
538
of vertices.
539
540
541
\>PosetRightClick( <poset>, <x>, <y> ) O
542
543
This operation is called when the user does a right click in the graph
544
<graph>. The generic method just finds the vertex under the mouse
545
pointer and calls the `rightclickfunction' of the poset or graph which
546
is a component in the {\GAP} object. Note that the `rightclickfunction'
547
can be called with `fail' if no vertex is hit.
548
549
550
551
\medskip%
552
*Operations for user actions:*
553
\medskip%
554
\>UserDeleteVerticesOp( <sheet>, <menu>, <entry> ) O
555
556
557
This operation is called when the user selects `Delete vertices'.
558
The generic method actually deletes the selected vertices including all
559
their edges.
560
561
562
\>UserDeleteEdgeOp( <sheet>, <menu>, <entry> ) O
563
564
565
This operation is called when the user selects `Delete edge'.
566
The generic method deletes the edge with no further warning!
567
568
569
\>UserMergeClassesOp( <sheet>, <menu>, <entry> ) O
570
571
572
This operation is called when the user selects `Merge Classes'.
573
The generic method walks through all levels and merges all classes that
574
contain a selected vertex. Afterwards `UserRearrangeClasses' is called.
575
576
577
\>UserMagnifyLattice( <sheet>, <menu>, <entry> ) O
578
579
580
This operation is called when the user selects `Magnify Lattice'.
581
The generic method scales everything by $144/100$ including the sheet,
582
all heights of levels and positions of vertices.
583
584
585
\>UserShrinkLattice( <sheet>, <menu>, <entry> ) O
586
587
588
This operation is called when the user selects `Shrink Lattice'.
589
The generic method scales everything by 100/144 including the sheet,
590
all heights of levels and positions of vertices.
591
592
593
\>UserResizeLattice( <sheet>, <menu>, <entry> ) O
594
595
596
This operation is called when the user selects `Resize Lattice'.
597
The generic method asks the user for an x and a y factor and scales
598
everything including the sheet, all heights of levels and positions of
599
vertices.
600
601
602
\>UserResizeSheet( <sheet>, <menu>, <entry> ) O
603
604
605
This operation is called when the user selects `Resize Sheet'.
606
The generic method asks the user for an x and a y pixel number and
607
changes the width and height of the sheet. No positions of levels and
608
vertices are changed. If the user asks for trouble he gets it!
609
610
611
\>UserMoveLattice( <sheet>, <menu>, <entry> ) O
612
613
614
This operation is called when the user selects `Move Lattice'.
615
The generic method asks the user for a pixel number and
616
changes the position of all vertices horizontally. No positions of
617
levels are changed.
618
619
620
\>UserChangeLabels( <sheet>, <menu>, <entry> ) O
621
622
623
This operation is called when the user selects `Change Labels'.
624
The user is prompted for every selected vertex, which label it should
625
have.
626
627
628
\>UserAverageY( <sheet>, <menu>, <entry> ) O
629
630
631
This operation is called when the user selects `Average Y Positions'.
632
In all levels the average y coordinate is calculated and all vertices are
633
moved to this y position.
634
635
636
\>UserAverageX( <sheet>, <menu>, <entry> ) O
637
638
639
This operation is called when the user selects `Average X Positions'.
640
The average of all x coordinates of the selected vertices is calculated.
641
Then all classes with a selected vertex are moved such that the first
642
selected vertex in this class has the calculated position as x position.
643
644
645
\>UserRearrangeClasses( <sheet>, <menu>, <entry> ) O
646
647
648
This operation is called when the user selects `Rearrange Classes'.
649
All classes with a selected vertex are rearranged: The vertices are
650
lined up neatly one after the other, sorted according to their current
651
x position.
652
653
654
\>UserUseBlackWhite( <sheet>, <menu>, <entry> ) O
655
656
657
This is called if the user selects `Use Black and White' in the menu.
658
659
660
\>PosetShowLevels( <sheet>, <menu>, <entry> ) O
661
662
663
This operation is called when the user selects `Show Levels' in the menu.
664
Switches the display of the little boxes for level handling on and off.
665
666
667
\>PosetShowLevelparams( <sheet>, <menu>, <entry> ) O
668
669
670
This operation is called when the user selects `Show Level Parameters' in
671
the menu. Switches the display of the level parameters at the right of
672
the screen on and off.
673
674
675
\>DoRedraw( <graph> ) O
676
677
Redraws all vertices and connections.
678
679
680
681
682
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
683
\Section{An Example}
684
685
This section shows how to use the poset package to display posets. The code
686
presented here is actually part of the {\XGAP} library and makes up the
687
link to the C MeatAxe.
688
689
This is the declaration part:
690
691
\begintt
692
#############################################################################
693
##
694
#W meataxe.gd XGAP library Max Neunhoeffer
695
##
696
#Y Copyright 1998, Max Neunhoeffer, Aachen, Germany
697
##
698
## This file contains declarations for MeatAxe posets
699
##
700
701
DeclareFilter("IsMeatAxeLattice");
702
703
#############################################################################
704
##
705
#O GraphicMeatAxeLattice(<name>, <width>, <height>) . creates graphic poset
706
##
707
## creates a new graphic MeatAxe lattice which is a specialization of a
708
## graphic poset. Those posets have a new filter for method selection.
709
##
710
DeclareOperation("GraphicMeatAxeLattice",[IsString, IsInt, IsInt]);
711
\endtt
712
713
The code only declares a new filter and declares a constructor operation
714
for posets that lie in this new filter.
715
716
The implementation:
717
718
\begintt
719
#############################################################################
720
##
721
#W meataxe.gi XGAP library Max Neunhoeffer
722
##
723
#Y Copyright 1998, Max Neunhoeffer, Aachen, Germany
724
##
725
## This file contains code for MeatAxe posets
726
##
727
728
#############################################################################
729
##
730
#M GraphicMeatAxeLattice(<name>, <width>, <height>) . creates graphic poset
731
##
732
## creates a new graphic MeatAxe lattice which is a specialization of a
733
## graphic poset. Those posets have a new filter for method selection.
734
##
735
InstallMethod( GraphicMeatAxeLattice,
736
"for a string, and two integers",
737
true,
738
[ IsString,
739
IsInt,
740
IsInt ],
741
0,
742
743
function( name, width, height )
744
local P;
745
746
P := GraphicPoset(name,width,height);
747
SetFilterObj(P,IsMeatAxeLattice);
748
return P;
749
end);
750
751
#############################################################################
752
##
753
#M CompareLevels(<poset>,<levelparam1>,<levelparam2>) . . . . . . . . . . .
754
## . . . . . . . . . . . . . . . . . . . . . . . . compares two levelparams
755
##
756
## Compare two level parameters. -1 means that <levelparam1> is "higher",
757
## 1 means that <levelparam2> is "higher", 0 means that they are equal.
758
## fail means that they are not comparable. This method is for the case
759
## if level parameters are integers and lower values mean lower levels
760
## like in the case of MeatAxe lattices of Michael Ringe.
761
##
762
InstallMethod( CompareLevels,
763
"for a graphic MeatAxe lattice, and two integers",
764
true,
765
[ IsGraphicPosetRep and IsMeatAxeLattice, IsInt, IsInt ],
766
0,
767
function( poset, l1, l2 )
768
if l1 < l2 then
769
return 1;
770
elif l1 > l2 then
771
return -1;
772
else
773
return 0;
774
fi;
775
end);
776
\endtt
777
778
Besides the new constructor (which only adds a new filter) we only have to
779
supply a new method for comparison of level parameters for such posets. The
780
levels are numbered with integer numbers such that lower numbers are lower
781
in the lattice.
782
783
There is a C program in the MeatAxe that exports a poset to a {\GAP}
784
program which generates the lattice in a graphic poset sheet. The user can
785
then interactively move around vertices and shrink or magnify levels. He
786
can then export the resulting lattice to an encapsulated postscript file.
787
Note that you need a full installation of the C MeatAxe apart from
788
{\GAP} to use this feature.
789
790
Another nice little example is in the `examples' subdirectory in the
791
{\XGAP} distribution. It was written by Thomas Breuer (Aachen) to
792
demonstrate the features of {\XGAP}. The user gets a small window with a
793
puzzle and can solve it using the mouse. You can test this example by
794
starting {\XGAP} and `Read'ing the file `pkg/xgap/examples/puzzle.g'.
795
You can do this by using
796
797
\begintt
798
gap> ReadPkg("xgap","examples/puzzle.g");
799
gap> p := Puzzle(4,4);
800
\endtt
801
802
803
804
805
806