File: graph_generation.out

package info (click to toggle)
postgresql-16-age 1.6.0~rc0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,016 kB
  • sloc: ansic: 33,556; sql: 13,270; python: 2,530; yacc: 2,518; java: 1,418; lex: 1,325; perl: 294; sh: 286; makefile: 123; javascript: 24
file content (230 lines) | stat: -rw-r--r-- 9,751 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
LOAD 'age';
SET search_path = ag_catalog;
SELECT * FROM create_complete_graph('gp1',5,'edges','vertices');
NOTICE:  graph "gp1" has been created
NOTICE:  VLabel "vertices" has been created
NOTICE:  ELabel "edges" has been created
 create_complete_graph 
-----------------------
 
(1 row)

SELECT COUNT(*) FROM gp1."edges";
 count 
-------
    10
(1 row)

SELECT COUNT(*) FROM gp1."vertices";
 count 
-------
     5
(1 row)

SELECT * FROM cypher('gp1', $$MATCH (a)-[e]->(b) RETURN e$$) as (n agtype);
                                                             n                                                              
----------------------------------------------------------------------------------------------------------------------------
 {"id": 1125899906842625, "label": "edges", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842629, "label": "edges", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842626, "label": "edges", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842630, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842627, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842632, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131971, "properties": {}}::edge
 {"id": 1125899906842631, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842634, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131972, "properties": {}}::edge
 {"id": 1125899906842633, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131971, "properties": {}}::edge
 {"id": 1125899906842628, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131969, "properties": {}}::edge
(10 rows)

SELECT * FROM create_complete_graph('gp1',5,'edges','vertices');
 create_complete_graph 
-----------------------
 
(1 row)

SELECT COUNT(*) FROM gp1."edges";
 count 
-------
    20
(1 row)

SELECT COUNT(*) FROM gp1."vertices";
 count 
-------
    10
(1 row)

SELECT * FROM create_complete_graph('gp2',5,'edges');
NOTICE:  graph "gp2" has been created
NOTICE:  ELabel "edges" has been created
 create_complete_graph 
-----------------------
 
(1 row)

-- SHOULD FAIL
SELECT * FROM create_complete_graph('gp3',5, NULL);
ERROR:  edge label can not be NULL
SELECT * FROM create_complete_graph('gp4',NULL,NULL);
ERROR:  number of nodes can not be NULL
SELECT * FROM create_complete_graph(NULL,NULL,NULL);
ERROR:  graph name can not be NULL
-- Should error out because same labels are used for both vertices and edges
SELECT * FROM create_complete_graph('gp5',5,'label','label');
ERROR:  vertex and edge label can not be same
-- DROPPING GRAPHS
SELECT drop_graph('gp1', true);
NOTICE:  drop cascades to 4 other objects
DETAIL:  drop cascades to table gp1._ag_label_vertex
drop cascades to table gp1._ag_label_edge
drop cascades to table gp1.vertices
drop cascades to table gp1.edges
NOTICE:  graph "gp1" has been dropped
 drop_graph 
------------
 
(1 row)

SELECT drop_graph('gp2', true);
NOTICE:  drop cascades to 3 other objects
DETAIL:  drop cascades to table gp2._ag_label_vertex
drop cascades to table gp2._ag_label_edge
drop cascades to table gp2.edges
NOTICE:  graph "gp2" has been dropped
 drop_graph 
------------
 
(1 row)

-- Tests for barbell graph generation
SELECT * FROM age_create_barbell_graph('gp1',5,0,'vertices',NULL,'edges',NULL);
NOTICE:  graph "gp1" has been created
NOTICE:  VLabel "vertices" has been created
NOTICE:  ELabel "edges" has been created
 age_create_barbell_graph 
--------------------------
 
(1 row)

SELECT COUNT(*) FROM gp1."edges";
 count 
-------
    21
(1 row)

SELECT COUNT(*) FROM gp1."vertices";
 count 
-------
    10
(1 row)

SELECT * FROM cypher('gp1', $$MATCH (a)-[e]->(b) RETURN e$$) as (n agtype);
                                                             n                                                              
----------------------------------------------------------------------------------------------------------------------------
 {"id": 1125899906842625, "label": "edges", "end_id": 844424930131970, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842629, "label": "edges", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842626, "label": "edges", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842627, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842632, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131971, "properties": {}}::edge
 {"id": 1125899906842630, "label": "edges", "end_id": 844424930131972, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842634, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131972, "properties": {}}::edge
 {"id": 1125899906842628, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131969, "properties": {}}::edge
 {"id": 1125899906842631, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131970, "properties": {}}::edge
 {"id": 1125899906842633, "label": "edges", "end_id": 844424930131973, "start_id": 844424930131971, "properties": {}}::edge
 {"id": 1125899906842635, "label": "edges", "end_id": 844424930131975, "start_id": 844424930131974, "properties": {}}::edge
 {"id": 1125899906842639, "label": "edges", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge
 {"id": 1125899906842636, "label": "edges", "end_id": 844424930131976, "start_id": 844424930131974, "properties": {}}::edge
 {"id": 1125899906842637, "label": "edges", "end_id": 844424930131977, "start_id": 844424930131974, "properties": {}}::edge
 {"id": 1125899906842642, "label": "edges", "end_id": 844424930131977, "start_id": 844424930131976, "properties": {}}::edge
 {"id": 1125899906842640, "label": "edges", "end_id": 844424930131977, "start_id": 844424930131975, "properties": {}}::edge
 {"id": 1125899906842644, "label": "edges", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge
 {"id": 1125899906842638, "label": "edges", "end_id": 844424930131978, "start_id": 844424930131974, "properties": {}}::edge
 {"id": 1125899906842641, "label": "edges", "end_id": 844424930131978, "start_id": 844424930131975, "properties": {}}::edge
 {"id": 1125899906842643, "label": "edges", "end_id": 844424930131978, "start_id": 844424930131976, "properties": {}}::edge
 {"id": 1125899906842645, "label": "edges", "end_id": 844424930131978, "start_id": 844424930131969, "properties": {}}::edge
(21 rows)

SELECT * FROM age_create_barbell_graph('gp1',5,0,'vertices',NULL,'edges',NULL);
 age_create_barbell_graph 
--------------------------
 
(1 row)

SELECT COUNT(*) FROM gp1."edges";
 count 
-------
    42
(1 row)

SELECT COUNT(*) FROM gp1."vertices";
 count 
-------
    20
(1 row)

SELECT * FROM age_create_barbell_graph('gp2',5,10,'vertices',NULL,'edges',NULL);
NOTICE:  graph "gp2" has been created
NOTICE:  VLabel "vertices" has been created
NOTICE:  ELabel "edges" has been created
 age_create_barbell_graph 
--------------------------
 
(1 row)

-- SHOULD FAIL
SELECT * FROM age_create_barbell_graph(NULL,NULL,NULL,NULL,NULL,NULL,NULL);
ERROR:  Graph name cannot be NULL
SELECT * FROM age_create_barbell_graph('gp2',NULL,0,'vertices',NULL,'edges',NULL); 
ERROR:  Graph size cannot be NULL or lower than 3
SELECT * FROM age_create_barbell_graph('gp3',5,NULL,'vertices',NULL,'edges',NULL);
ERROR:  Bridge size cannot be NULL or lower than 0
SELECT * FROM age_create_barbell_graph('gp4',NULL,0,'vertices',NULL,'edges',NULL);
ERROR:  Graph size cannot be NULL or lower than 3
SELECT * FROM age_create_barbell_graph('gp5',5,0,'vertices',NULL,NULL,NULL);
ERROR:  edge label can not be NULL
-- Should error out because same labels are used for both vertices and edges
SELECT * FROM age_create_barbell_graph('gp6',5,10,'label',NULL,'label',NULL);
ERROR:  vertex and edge label can not be same
-- DROPPING GRAPHS
SELECT drop_graph('gp1', true);
NOTICE:  drop cascades to 4 other objects
DETAIL:  drop cascades to table gp1._ag_label_vertex
drop cascades to table gp1._ag_label_edge
drop cascades to table gp1.vertices
drop cascades to table gp1.edges
NOTICE:  graph "gp1" has been dropped
 drop_graph 
------------
 
(1 row)

SELECT drop_graph('gp2', true);
NOTICE:  drop cascades to 4 other objects
DETAIL:  drop cascades to table gp2._ag_label_vertex
drop cascades to table gp2._ag_label_edge
drop cascades to table gp2.vertices
drop cascades to table gp2.edges
NOTICE:  graph "gp2" has been dropped
 drop_graph 
------------
 
(1 row)