Skip to content

Commit 8f9acf9

Browse files
committed
chore(gfql): extend ref enumerator for hop ranges
1 parent ba0beb2 commit 8f9acf9

File tree

6 files changed

+255
-103
lines changed

6 files changed

+255
-103
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pypirc
1414
# Distribution / packaging
1515
.Python
1616
env/
17+
.venv/
18+
.hypothesis/
1719
build/
1820
develop-eggs/
1921
dist/

docs/source/gfql/hop_bounds.ipynb

Lines changed: 74 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"id": "b21b97b8",
2929
"metadata": {
3030
"execution": {
31-
"iopub.execute_input": "2025-12-01T06:49:43.434717Z",
32-
"iopub.status.busy": "2025-12-01T06:49:43.434616Z",
33-
"iopub.status.idle": "2025-12-01T06:49:43.842731Z",
34-
"shell.execute_reply": "2025-12-01T06:49:43.842270Z"
31+
"iopub.execute_input": "2025-12-01T23:59:40.523337Z",
32+
"iopub.status.busy": "2025-12-01T23:59:40.523070Z",
33+
"iopub.status.idle": "2025-12-01T23:59:41.274958Z",
34+
"shell.execute_reply": "2025-12-01T23:59:41.273610Z"
3535
}
3636
},
3737
"outputs": [
@@ -92,10 +92,10 @@
9292
"id": "2a41ab6a",
9393
"metadata": {
9494
"execution": {
95-
"iopub.execute_input": "2025-12-01T06:49:43.843876Z",
96-
"iopub.status.busy": "2025-12-01T06:49:43.843669Z",
97-
"iopub.status.idle": "2025-12-01T06:49:43.849888Z",
98-
"shell.execute_reply": "2025-12-01T06:49:43.849507Z"
95+
"iopub.execute_input": "2025-12-01T23:59:41.277891Z",
96+
"iopub.status.busy": "2025-12-01T23:59:41.277498Z",
97+
"iopub.status.idle": "2025-12-01T23:59:41.291927Z",
98+
"shell.execute_reply": "2025-12-01T23:59:41.290547Z"
9999
}
100100
},
101101
"outputs": [],
@@ -183,10 +183,10 @@
183183
"id": "d197392a",
184184
"metadata": {
185185
"execution": {
186-
"iopub.execute_input": "2025-12-01T06:49:43.850833Z",
187-
"iopub.status.busy": "2025-12-01T06:49:43.850723Z",
188-
"iopub.status.idle": "2025-12-01T06:49:43.854869Z",
189-
"shell.execute_reply": "2025-12-01T06:49:43.854546Z"
186+
"iopub.execute_input": "2025-12-01T23:59:41.295129Z",
187+
"iopub.status.busy": "2025-12-01T23:59:41.294778Z",
188+
"iopub.status.idle": "2025-12-01T23:59:41.305581Z",
189+
"shell.execute_reply": "2025-12-01T23:59:41.304412Z"
190190
}
191191
},
192192
"outputs": [
@@ -254,10 +254,10 @@
254254
"id": "4967ba69",
255255
"metadata": {
256256
"execution": {
257-
"iopub.execute_input": "2025-12-01T06:49:43.855680Z",
258-
"iopub.status.busy": "2025-12-01T06:49:43.855585Z",
259-
"iopub.status.idle": "2025-12-01T06:49:43.927053Z",
260-
"shell.execute_reply": "2025-12-01T06:49:43.926610Z"
257+
"iopub.execute_input": "2025-12-01T23:59:41.308116Z",
258+
"iopub.status.busy": "2025-12-01T23:59:41.307879Z",
259+
"iopub.status.idle": "2025-12-01T23:59:41.455868Z",
260+
"shell.execute_reply": "2025-12-01T23:59:41.454545Z"
261261
}
262262
},
263263
"outputs": [
@@ -331,10 +331,10 @@
331331
"id": "80057761",
332332
"metadata": {
333333
"execution": {
334-
"iopub.execute_input": "2025-12-01T06:49:43.928251Z",
335-
"iopub.status.busy": "2025-12-01T06:49:43.928136Z",
336-
"iopub.status.idle": "2025-12-01T06:49:44.024695Z",
337-
"shell.execute_reply": "2025-12-01T06:49:44.024369Z"
334+
"iopub.execute_input": "2025-12-01T23:59:41.459006Z",
335+
"iopub.status.busy": "2025-12-01T23:59:41.458713Z",
336+
"iopub.status.idle": "2025-12-01T23:59:41.677985Z",
337+
"shell.execute_reply": "2025-12-01T23:59:41.676855Z"
338338
}
339339
},
340340
"outputs": [
@@ -346,17 +346,13 @@
346346
" id __gfql_output_node_hop__\n",
347347
"0 a <NA>\n",
348348
"1 b1 1\n",
349-
"3 b2 1\n",
350349
"2 c1 2\n",
351-
"5 c2 2\n",
352-
"4 d1 3\n",
350+
"3 d1 3\n",
353351
"\n",
354352
"3-hop edges:\n",
355353
" __gfql_output_edge_hop__ s d\n",
356354
"0 1 a b1\n",
357-
"3 1 a b2\n",
358355
"1 2 b1 c1\n",
359-
"4 2 b2 c2\n",
360356
"2 3 c1 d1\n"
361357
]
362358
},
@@ -370,20 +366,14 @@
370366
"<line x1=\"70\" y1=\"100\" x2=\"130\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
371367
"<line x1=\"170\" y1=\"70\" x2=\"230\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
372368
"<line x1=\"270\" y1=\"70\" x2=\"330\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
373-
"<line x1=\"70\" y1=\"100\" x2=\"130\" y2=\"130\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
374-
"<line x1=\"170\" y1=\"130\" x2=\"230\" y2=\"130\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
375369
"<circle cx=\"50\" cy=\"100\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
376370
"<text x=\"50\" y=\"100\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">a</text>\n",
377371
"<circle cx=\"150\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
378372
"<text x=\"150\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">b1</text>\n",
379373
"<circle cx=\"250\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
380374
"<text x=\"250\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">c1</text>\n",
381-
"<circle cx=\"150\" cy=\"130\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
382-
"<text x=\"150\" y=\"130\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">b2</text>\n",
383375
"<circle cx=\"350\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
384376
"<text x=\"350\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">d1</text>\n",
385-
"<circle cx=\"250\" cy=\"130\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
386-
"<text x=\"250\" y=\"130\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">c2</text>\n",
387377
"</svg>"
388378
],
389379
"text/plain": [
@@ -433,25 +423,18 @@
433423
"id": "0ab5310b",
434424
"metadata": {
435425
"execution": {
436-
"iopub.execute_input": "2025-12-01T06:49:44.025955Z",
437-
"iopub.status.busy": "2025-12-01T06:49:44.025851Z",
438-
"iopub.status.idle": "2025-12-01T06:49:44.131014Z",
439-
"shell.execute_reply": "2025-12-01T06:49:44.130596Z"
426+
"iopub.execute_input": "2025-12-01T23:59:41.680783Z",
427+
"iopub.status.busy": "2025-12-01T23:59:41.680450Z",
428+
"iopub.status.idle": "2025-12-01T23:59:41.889793Z",
429+
"shell.execute_reply": "2025-12-01T23:59:41.888400Z"
440430
}
441431
},
442432
"outputs": [
443433
{
444434
"name": "stdout",
445435
"output_type": "stream",
446436
"text": [
447-
"Nodes within 1..3 hops from 'a':"
448-
]
449-
},
450-
{
451-
"name": "stdout",
452-
"output_type": "stream",
453-
"text": [
454-
"\n",
437+
"Nodes within 1..3 hops from 'a':\n",
455438
" id __gfql_output_node_hop__\n",
456439
"0 a <NA>\n",
457440
"1 b1 1\n",
@@ -460,7 +443,13 @@
460443
"5 c2 2\n",
461444
"4 d1 3\n",
462445
"\n",
463-
"Edges within 1..3 hops:\n",
446+
"Edges within 1..3 hops:\n"
447+
]
448+
},
449+
{
450+
"name": "stdout",
451+
"output_type": "stream",
452+
"text": [
464453
" __gfql_output_edge_hop__ s d\n",
465454
"0 1 a b1\n",
466455
"3 1 a b2\n",
@@ -541,10 +530,10 @@
541530
"id": "4928bfdc",
542531
"metadata": {
543532
"execution": {
544-
"iopub.execute_input": "2025-12-01T06:49:44.131965Z",
545-
"iopub.status.busy": "2025-12-01T06:49:44.131813Z",
546-
"iopub.status.idle": "2025-12-01T06:49:44.244645Z",
547-
"shell.execute_reply": "2025-12-01T06:49:44.244205Z"
533+
"iopub.execute_input": "2025-12-01T23:59:41.892458Z",
534+
"iopub.status.busy": "2025-12-01T23:59:41.892138Z",
535+
"iopub.status.idle": "2025-12-01T23:59:42.167012Z",
536+
"shell.execute_reply": "2025-12-01T23:59:42.165892Z"
548537
}
549538
},
550539
"outputs": [
@@ -619,10 +608,10 @@
619608
"id": "75a454a5",
620609
"metadata": {
621610
"execution": {
622-
"iopub.execute_input": "2025-12-01T06:49:44.245712Z",
623-
"iopub.status.busy": "2025-12-01T06:49:44.245613Z",
624-
"iopub.status.idle": "2025-12-01T06:49:44.345930Z",
625-
"shell.execute_reply": "2025-12-01T06:49:44.345473Z"
611+
"iopub.execute_input": "2025-12-01T23:59:42.170075Z",
612+
"iopub.status.busy": "2025-12-01T23:59:42.169768Z",
613+
"iopub.status.idle": "2025-12-01T23:59:42.421931Z",
614+
"shell.execute_reply": "2025-12-01T23:59:42.421113Z"
626615
}
627616
},
628617
"outputs": [
@@ -634,17 +623,13 @@
634623
" id hop\n",
635624
"0 a 0\n",
636625
"1 b1 1\n",
637-
"2 b2 1\n",
638-
"3 c1 2\n",
639-
"4 c2 2\n",
640-
"5 d1 3\n",
626+
"2 c1 2\n",
627+
"3 d1 3\n",
641628
"\n",
642629
"Edges when output_min < min_hops:\n",
643630
" edge_hop s d\n",
644631
"0 1 a b1\n",
645-
"3 1 a b2\n",
646632
"1 2 b1 c1\n",
647-
"4 2 b2 c2\n",
648633
"2 3 c1 d1\n"
649634
]
650635
},
@@ -658,18 +643,12 @@
658643
"<line x1=\"70\" y1=\"100\" x2=\"130\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
659644
"<line x1=\"170\" y1=\"70\" x2=\"230\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
660645
"<line x1=\"270\" y1=\"70\" x2=\"330\" y2=\"70\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
661-
"<line x1=\"70\" y1=\"100\" x2=\"130\" y2=\"130\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
662-
"<line x1=\"170\" y1=\"130\" x2=\"230\" y2=\"130\" stroke=\"#1f4b99\" stroke-width=\"2\" marker-end=\"url(#arrow)\"/>\n",
663646
"<circle cx=\"50\" cy=\"100\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
664647
"<text x=\"50\" y=\"100\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">a:0</text>\n",
665648
"<circle cx=\"150\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
666649
"<text x=\"150\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">b1:1</text>\n",
667-
"<circle cx=\"150\" cy=\"130\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
668-
"<text x=\"150\" y=\"130\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">b2:1</text>\n",
669650
"<circle cx=\"250\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
670651
"<text x=\"250\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">c1:2</text>\n",
671-
"<circle cx=\"250\" cy=\"130\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
672-
"<text x=\"250\" y=\"130\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">c2:2</text>\n",
673652
"<circle cx=\"350\" cy=\"70\" r=\"20\" fill=\"#eef3ff\" stroke=\"#1f4b99\" stroke-width=\"2\"/>\n",
674653
"<text x=\"350\" y=\"70\" text-anchor=\"middle\" alignment-baseline=\"middle\" font-size=\"14\" fill=\"#0a1a2f\">d1:3</text>\n",
675654
"</svg>"
@@ -712,18 +691,24 @@
712691
"id": "c7c3a6c2",
713692
"metadata": {
714693
"execution": {
715-
"iopub.execute_input": "2025-12-01T06:49:44.347185Z",
716-
"iopub.status.busy": "2025-12-01T06:49:44.347077Z",
717-
"iopub.status.idle": "2025-12-01T06:49:44.434379Z",
718-
"shell.execute_reply": "2025-12-01T06:49:44.433946Z"
694+
"iopub.execute_input": "2025-12-01T23:59:42.425115Z",
695+
"iopub.status.busy": "2025-12-01T23:59:42.424761Z",
696+
"iopub.status.idle": "2025-12-01T23:59:42.638704Z",
697+
"shell.execute_reply": "2025-12-01T23:59:42.637327Z"
719698
}
720699
},
721700
"outputs": [
722701
{
723702
"name": "stdout",
724703
"output_type": "stream",
725704
"text": [
726-
"Edges when output_max > traversal max (still capped at traversal):\n",
705+
"Edges when output_max > traversal max (still capped at traversal):\n"
706+
]
707+
},
708+
{
709+
"name": "stdout",
710+
"output_type": "stream",
711+
"text": [
727712
" edge_hop s d\n",
728713
"0 1 a b1\n",
729714
"2 1 a b2\n",
@@ -788,10 +773,10 @@
788773
"id": "7b742ce8",
789774
"metadata": {
790775
"execution": {
791-
"iopub.execute_input": "2025-12-01T06:49:44.435761Z",
792-
"iopub.status.busy": "2025-12-01T06:49:44.435662Z",
793-
"iopub.status.idle": "2025-12-01T06:49:44.438123Z",
794-
"shell.execute_reply": "2025-12-01T06:49:44.437737Z"
776+
"iopub.execute_input": "2025-12-01T23:59:42.641332Z",
777+
"iopub.status.busy": "2025-12-01T23:59:42.641055Z",
778+
"iopub.status.idle": "2025-12-01T23:59:42.646480Z",
779+
"shell.execute_reply": "2025-12-01T23:59:42.645183Z"
795780
}
796781
},
797782
"outputs": [
@@ -844,18 +829,24 @@
844829
"id": "4cb78f8b",
845830
"metadata": {
846831
"execution": {
847-
"iopub.execute_input": "2025-12-01T06:49:44.438977Z",
848-
"iopub.status.busy": "2025-12-01T06:49:44.438886Z",
849-
"iopub.status.idle": "2025-12-01T06:49:44.540772Z",
850-
"shell.execute_reply": "2025-12-01T06:49:44.540255Z"
832+
"iopub.execute_input": "2025-12-01T23:59:42.649650Z",
833+
"iopub.status.busy": "2025-12-01T23:59:42.649260Z",
834+
"iopub.status.idle": "2025-12-01T23:59:42.891641Z",
835+
"shell.execute_reply": "2025-12-01T23:59:42.890314Z"
851836
}
852837
},
853838
"outputs": [
854839
{
855840
"name": "stdout",
856841
"output_type": "stream",
857842
"text": [
858-
"Nodes with hop labels (seeds not labeled):\n",
843+
"Nodes with hop labels (seeds not labeled):\n"
844+
]
845+
},
846+
{
847+
"name": "stdout",
848+
"output_type": "stream",
849+
"text": [
859850
" id hop\n",
860851
"1 b1 1\n",
861852
"3 b2 1\n",
@@ -937,10 +928,10 @@
937928
"id": "efbdff59",
938929
"metadata": {
939930
"execution": {
940-
"iopub.execute_input": "2025-12-01T06:49:44.541747Z",
941-
"iopub.status.busy": "2025-12-01T06:49:44.541648Z",
942-
"iopub.status.idle": "2025-12-01T06:49:44.642771Z",
943-
"shell.execute_reply": "2025-12-01T06:49:44.642364Z"
931+
"iopub.execute_input": "2025-12-01T23:59:42.894439Z",
932+
"iopub.status.busy": "2025-12-01T23:59:42.894083Z",
933+
"iopub.status.idle": "2025-12-01T23:59:43.129411Z",
934+
"shell.execute_reply": "2025-12-01T23:59:43.128136Z"
944935
}
945936
},
946937
"outputs": [
@@ -1028,7 +1019,7 @@
10281019
"name": "python",
10291020
"nbconvert_exporter": "python",
10301021
"pygments_lexer": "ipython3",
1031-
"version": "3.12.11"
1022+
"version": "3.12.3"
10321023
}
10331024
},
10341025
"nbformat": 4,

0 commit comments

Comments
 (0)