CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

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

Views: 418346
1
2
2 Token Passing Networks
3
4
A token passing network is a directed graph with a designated input node and
5
a designated output node. The input node has no incoming edges whereas the
6
output node has no outgoing edges. Also the input node generates a sequence
7
of tokens, labelled 1, 2, 3, ... . These tokens are passed on to the nodes
8
within the graph, where each node, apart from the input and output node, can
9
hold at most one token at any time. The edges do not hold tokens but are
10
there to pass them on. The following must hold if a token t moves from the
11
node x to the node y.
12
13
There is an edge from x to y; x is the input node, and the tokens 1, 2, 3,
14
... , t-1 have been moved, or x is any other node but not the output node;
15
lastly either y is the output node or y is not the input node and currently
16
is not occupied by a token. [3]
17
18
Token passing networks, or TPNs, are represented in GAP as a list. Each
19
entry of the list is the index of the node within the TPN and contains a
20
list of the "destinations", i.e. the end of the edge or arrow where it is
21
directed to.
22
23
Here is an example how the input of such a TPN looks in GAP:
24
25
 Example 
26
gap> hex:=[[2,3],[4],[5],[3,6],[6],[]];
27
[ [ 2, 3 ], [ 4 ], [ 5 ], [ 3, 6 ], [ 6 ], [ ] ]
28
gap> 
29

30
31
From this it is visible that the input node is 1, as it has no other node
32
pointing any arrows towards it, and the output node is 6, as it has no
33
destinations (hence the empty list).
34
35
36
2.1 Specific TPN
37
38
In PatternClass there are several functions that define different kinds of
39
specific token passing networks.
40
41
2.1-1 Parstacks
42
43
Parstacks( m, n )  function
44
Returns: A list that represents the directed edges of a token passing
45
network.
46
47
Parstacks constructs a token passing network with 2 different sized stacks
48
m,n positioned in parallel.
49
50
 Example 
51
gap> Parstacks(2,2);
52
[ [ 2, 4 ], [ 3, 6 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
53
gap> 
54

55
56
 Example 
57
gap> Parstacks(4,3);
58
[ [ 2, 6 ], [ 3, 9 ], [ 2, 4 ], [ 3, 5 ], [ 4 ], [ 7, 9 ], [ 6, 8 ], [ 7 ],
59
 [ ] ]
60
gap> 
61

62
63
2.1-2 Seqstacks
64
65
Seqstacks( n[, m[, o[, p[, ...]]]] )  function
66
Returns: A list that represents the directed edges of a token passing
67
network.
68
69
The token passing network build by Seqstacks contains a series of stacks (as
70
many as you have integers in the arguments list) each of different length
71
(each integer in the argument list).
72
73
 Example 
74
gap> Seqstacks(2,2);
75
[ [ 2 ], [ 3, 4 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
76
gap> 
77

78
79
 Example 
80
gap> Seqstacks(3,1,4);
81
[ [ 2 ], [ 3, 5 ], [ 2, 4 ], [ 3 ], [ 4 ], [ 7, 10 ], [ 6, 8 ], [ 7, 9 ], 
82
 [ 8 ], [ ] ]
83
gap> 
84

85
86
2.1-3 BufferAndStack
87
88
BufferAndStack( m, n )  function
89
Returns: A list that represents the directed edges of a token passing
90
network.
91
92
BufferAndStack is a token passing network that consists of a buffer of size
93
m which is followed by a single stack of size n.
94
95
 Example 
96
gap> BufferAndStack(2,2);
97
[ [ 2, 3 ], [ 4 ], [ 4 ], [ 5, 6 ], [ 4 ], [ ] ]
98
gap> 
99

100
101
 Example 
102
gap> BufferAndStack(4,3);
103
[ [ 2 .. 5 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 7, 9 ], [ 6, 8 ], [ 7 ], [ ] ]
104
gap> 
105

106
107
108