Skip to content

Commit 61c6f6e

Browse files
authored
254 potential problems with graphweighted outdegrees, fixes #254 (#290)
* new semantics of degree calculation * updated tutorial, fixing str type * updated degree statistics
1 parent 5767c53 commit 61c6f6e

5 files changed

Lines changed: 233 additions & 92 deletions

File tree

docs/tutorial/basic_concepts.ipynb

Lines changed: 174 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,18 @@
171171
},
172172
{
173173
"cell_type": "code",
174-
"execution_count": null,
174+
"execution_count": 6,
175175
"metadata": {},
176-
"outputs": [],
176+
"outputs": [
177+
{
178+
"name": "stdout",
179+
"output_type": "stream",
180+
"text": [
181+
"EdgeIndex([[0, 0, 1],\n",
182+
" [2, 1, 2]], sparse_size=(4, 4), nnz=3, sort_order=row)\n"
183+
]
184+
}
185+
],
177186
"source": [
178187
"print(g.data.edge_index)"
179188
]
@@ -194,7 +203,7 @@
194203
},
195204
{
196205
"cell_type": "code",
197-
"execution_count": 7,
206+
"execution_count": 5,
198207
"metadata": {},
199208
"outputs": [
200209
{
@@ -228,7 +237,7 @@
228237
},
229238
{
230239
"cell_type": "code",
231-
"execution_count": 8,
240+
"execution_count": 6,
232241
"metadata": {},
233242
"outputs": [
234243
{
@@ -257,7 +266,7 @@
257266
},
258267
{
259268
"cell_type": "code",
260-
"execution_count": 12,
269+
"execution_count": 10,
261270
"metadata": {},
262271
"outputs": [
263272
{
@@ -274,7 +283,7 @@
274283
},
275284
{
276285
"cell_type": "code",
277-
"execution_count": 14,
286+
"execution_count": 11,
278287
"metadata": {},
279288
"outputs": [
280289
{
@@ -298,7 +307,7 @@
298307
},
299308
{
300309
"cell_type": "code",
301-
"execution_count": 15,
310+
"execution_count": 12,
302311
"metadata": {},
303312
"outputs": [],
304313
"source": [
@@ -314,20 +323,20 @@
314323
},
315324
{
316325
"cell_type": "code",
317-
"execution_count": 16,
326+
"execution_count": 7,
318327
"metadata": {},
319328
"outputs": [
320329
{
321330
"name": "stdout",
322331
"output_type": "stream",
323332
"text": [
324-
"a\n",
325-
"b\n",
326-
"c\n",
327-
"d\n",
328-
"('a', 'c')\n",
329-
"('a', 'b')\n",
330-
"('b', 'c')\n"
333+
"0\n",
334+
"1\n",
335+
"2\n",
336+
"3\n",
337+
"(0, 2)\n",
338+
"(0, 1)\n",
339+
"(1, 2)\n"
331340
]
332341
}
333342
],
@@ -348,7 +357,7 @@
348357
},
349358
{
350359
"cell_type": "code",
351-
"execution_count": 19,
360+
"execution_count": 8,
352361
"metadata": {},
353362
"outputs": [],
354363
"source": [
@@ -364,7 +373,7 @@
364373
},
365374
{
366375
"cell_type": "code",
367-
"execution_count": 20,
376+
"execution_count": 9,
368377
"metadata": {},
369378
"outputs": [
370379
{
@@ -398,7 +407,7 @@
398407
},
399408
{
400409
"cell_type": "code",
401-
"execution_count": 21,
410+
"execution_count": 11,
402411
"metadata": {},
403412
"outputs": [
404413
{
@@ -435,7 +444,7 @@
435444
},
436445
{
437446
"cell_type": "code",
438-
"execution_count": 22,
447+
"execution_count": 12,
439448
"metadata": {},
440449
"outputs": [
441450
{
@@ -444,7 +453,7 @@
444453
"tensor([2, 1])"
445454
]
446455
},
447-
"execution_count": 22,
456+
"execution_count": 12,
448457
"metadata": {},
449458
"output_type": "execute_result"
450459
}
@@ -609,7 +618,7 @@
609618
},
610619
{
611620
"cell_type": "code",
612-
"execution_count": 34,
621+
"execution_count": 13,
613622
"metadata": {},
614623
"outputs": [
615624
{
@@ -627,6 +636,136 @@
627636
" print(f\"{v} -> {g.in_degrees[v]}\")"
628637
]
629638
},
639+
{
640+
"cell_type": "markdown",
641+
"metadata": {},
642+
"source": [
643+
"The `in_degree` and `out_degree` properties are shortcuts to a general `degree` function that can be used to calculate (weighted) in- and outdegrees. "
644+
]
645+
},
646+
{
647+
"cell_type": "code",
648+
"execution_count": 15,
649+
"metadata": {},
650+
"outputs": [
651+
{
652+
"data": {
653+
"text/plain": [
654+
"{'a': 0, 'c': 2, 'b': 1}"
655+
]
656+
},
657+
"execution_count": 15,
658+
"metadata": {},
659+
"output_type": "execute_result"
660+
}
661+
],
662+
"source": [
663+
"g.degrees(mode='in')"
664+
]
665+
},
666+
{
667+
"cell_type": "code",
668+
"execution_count": 16,
669+
"metadata": {},
670+
"outputs": [
671+
{
672+
"data": {
673+
"text/plain": [
674+
"{'a': 2, 'c': 0, 'b': 1}"
675+
]
676+
},
677+
"execution_count": 16,
678+
"metadata": {},
679+
"output_type": "execute_result"
680+
}
681+
],
682+
"source": [
683+
"g.degrees(mode='out')"
684+
]
685+
},
686+
{
687+
"cell_type": "markdown",
688+
"metadata": {},
689+
"source": [
690+
"Degrees can be alternatively returned as torch.tensors."
691+
]
692+
},
693+
{
694+
"cell_type": "code",
695+
"execution_count": 17,
696+
"metadata": {},
697+
"outputs": [
698+
{
699+
"data": {
700+
"text/plain": [
701+
"tensor([0, 2, 1], dtype=torch.int32)"
702+
]
703+
},
704+
"execution_count": 17,
705+
"metadata": {},
706+
"output_type": "execute_result"
707+
}
708+
],
709+
"source": [
710+
"g.degrees(mode='in', return_tensor=True)"
711+
]
712+
},
713+
{
714+
"cell_type": "markdown",
715+
"metadata": {},
716+
"source": [
717+
"We can also use arbitrary numerical edge attributes that will be used for a weighted (in- or out) degree calculation."
718+
]
719+
},
720+
{
721+
"cell_type": "code",
722+
"execution_count": 18,
723+
"metadata": {},
724+
"outputs": [],
725+
"source": [
726+
"g.data.edge_weight=torch.tensor([1.0, 2.0, 3.0])"
727+
]
728+
},
729+
{
730+
"cell_type": "code",
731+
"execution_count": 19,
732+
"metadata": {},
733+
"outputs": [
734+
{
735+
"data": {
736+
"text/plain": [
737+
"tensor([0., 5., 1.])"
738+
]
739+
},
740+
"execution_count": 19,
741+
"metadata": {},
742+
"output_type": "execute_result"
743+
}
744+
],
745+
"source": [
746+
"g.degrees(mode='in', edge_attr='edge_weight', return_tensor=True)"
747+
]
748+
},
749+
{
750+
"cell_type": "code",
751+
"execution_count": 20,
752+
"metadata": {},
753+
"outputs": [
754+
{
755+
"data": {
756+
"text/plain": [
757+
"tensor([3., 0., 3.])"
758+
]
759+
},
760+
"execution_count": 20,
761+
"metadata": {},
762+
"output_type": "execute_result"
763+
}
764+
],
765+
"source": [
766+
"g.degrees(mode='out', edge_attr='edge_weight', return_tensor=True)"
767+
]
768+
},
630769
{
631770
"cell_type": "markdown",
632771
"metadata": {},
@@ -636,16 +775,16 @@
636775
},
637776
{
638777
"cell_type": "code",
639-
"execution_count": 35,
778+
"execution_count": 21,
640779
"metadata": {},
641780
"outputs": [
642781
{
643782
"data": {
644783
"text/plain": [
645-
"Data(edge_index=[2, 3], num_nodes=3, node_sequence=[3, 1])"
784+
"Data(edge_index=[2, 3], num_nodes=3, node_sequence=[3, 1], edge_weight=[3])"
646785
]
647786
},
648-
"execution_count": 35,
787+
"execution_count": 21,
649788
"metadata": {},
650789
"output_type": "execute_result"
651790
}
@@ -690,7 +829,7 @@
690829
},
691830
{
692831
"cell_type": "code",
693-
"execution_count": 37,
832+
"execution_count": 16,
694833
"metadata": {},
695834
"outputs": [
696835
{
@@ -700,8 +839,8 @@
700839
"traceback": [
701840
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
702841
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
703-
"Cell \u001b[0;32mIn[37], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m g \u001b[38;5;241m=\u001b[39m \u001b[43mpp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mGraph\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_edge_list\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ma\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ma\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcuda\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2\u001b[0m g\u001b[38;5;241m.\u001b[39mdata\u001b[38;5;241m.\u001b[39mis_cuda\n",
704-
"File \u001b[0;32m/workspaces/pathpyG/src/pathpyG/core/graph.py:180\u001b[0m, in \u001b[0;36mGraph.from_edge_list\u001b[0;34m(edge_list, is_undirected, mapping, num_nodes, device)\u001b[0m\n\u001b[1;32m 176\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m num_nodes \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 177\u001b[0m num_nodes \u001b[38;5;241m=\u001b[39m mapping\u001b[38;5;241m.\u001b[39mnum_ids()\n\u001b[1;32m 179\u001b[0m edge_index \u001b[38;5;241m=\u001b[39m EdgeIndex(\n\u001b[0;32m--> 180\u001b[0m \u001b[43mmapping\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_idxs\u001b[49m\u001b[43m(\u001b[49m\u001b[43medge_list\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdevice\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mT\u001b[38;5;241m.\u001b[39mcontiguous(),\n\u001b[1;32m 181\u001b[0m sparse_size\u001b[38;5;241m=\u001b[39m(num_nodes, num_nodes),\n\u001b[1;32m 182\u001b[0m is_undirected\u001b[38;5;241m=\u001b[39mis_undirected,\n\u001b[1;32m 183\u001b[0m )\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Graph(Data(edge_index\u001b[38;5;241m=\u001b[39medge_index, num_nodes\u001b[38;5;241m=\u001b[39mnum_nodes), mapping\u001b[38;5;241m=\u001b[39mmapping)\n",
842+
"Cell \u001b[0;32mIn[16], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m g \u001b[38;5;241m=\u001b[39m \u001b[43mpp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mGraph\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_edge_list\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ma\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ma\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcuda\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2\u001b[0m g\u001b[38;5;241m.\u001b[39mdata\u001b[38;5;241m.\u001b[39mis_cuda\n",
843+
"File \u001b[0;32m/workspaces/pathpyG/src/pathpyG/core/graph.py:179\u001b[0m, in \u001b[0;36mGraph.from_edge_list\u001b[0;34m(edge_list, is_undirected, mapping, device)\u001b[0m\n\u001b[1;32m 174\u001b[0m mapping \u001b[38;5;241m=\u001b[39m IndexMap(node_ids)\n\u001b[1;32m 176\u001b[0m num_nodes \u001b[38;5;241m=\u001b[39m mapping\u001b[38;5;241m.\u001b[39mnum_ids()\n\u001b[1;32m 178\u001b[0m edge_index \u001b[38;5;241m=\u001b[39m EdgeIndex(\n\u001b[0;32m--> 179\u001b[0m \u001b[43mmapping\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_idxs\u001b[49m\u001b[43m(\u001b[49m\u001b[43medge_list\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdevice\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mT\u001b[38;5;241m.\u001b[39mcontiguous(),\n\u001b[1;32m 180\u001b[0m sparse_size\u001b[38;5;241m=\u001b[39m(num_nodes, num_nodes),\n\u001b[1;32m 181\u001b[0m is_undirected\u001b[38;5;241m=\u001b[39mis_undirected,\n\u001b[1;32m 182\u001b[0m )\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Graph(Data(edge_index\u001b[38;5;241m=\u001b[39medge_index, num_nodes\u001b[38;5;241m=\u001b[39mnum_nodes), mapping\u001b[38;5;241m=\u001b[39mmapping)\n",
705844
"File \u001b[0;32m/workspaces/pathpyG/src/pathpyG/core/index_map.py:361\u001b[0m, in \u001b[0;36mIndexMap.to_idxs\u001b[0;34m(self, nodes, device)\u001b[0m\n\u001b[1;32m 359\u001b[0m shape \u001b[38;5;241m=\u001b[39m nodes\u001b[38;5;241m.\u001b[39mshape\n\u001b[1;32m 360\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mid_shape \u001b[38;5;241m==\u001b[39m (\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m,):\n\u001b[0;32m--> 361\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtensor\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mid_to_idx\u001b[49m\u001b[43m[\u001b[49m\u001b[43mnode\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mnode\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mnodes\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mflatten\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdevice\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mreshape(shape)\n\u001b[1;32m 362\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 363\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m torch\u001b[38;5;241m.\u001b[39mtensor([\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mid_to_idx[\u001b[38;5;28mtuple\u001b[39m(node)] \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m nodes\u001b[38;5;241m.\u001b[39mreshape(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mid_shape)], device\u001b[38;5;241m=\u001b[39mdevice)\u001b[38;5;241m.\u001b[39mreshape(\n\u001b[1;32m 364\u001b[0m shape[: \u001b[38;5;241m-\u001b[39m\u001b[38;5;28mlen\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mid_shape) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 365\u001b[0m )\n",
706845
"File \u001b[0;32m/opt/conda/lib/python3.11/site-packages/torch/cuda/__init__.py:314\u001b[0m, in \u001b[0;36m_lazy_init\u001b[0;34m()\u001b[0m\n\u001b[1;32m 312\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCUDA_MODULE_LOADING\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m os\u001b[38;5;241m.\u001b[39menviron:\n\u001b[1;32m 313\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCUDA_MODULE_LOADING\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLAZY\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 314\u001b[0m \u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_C\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_cuda_init\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 315\u001b[0m \u001b[38;5;66;03m# Some of the queued calls may reentrantly call _lazy_init();\u001b[39;00m\n\u001b[1;32m 316\u001b[0m \u001b[38;5;66;03m# we need to just return without initializing in that case.\u001b[39;00m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;66;03m# However, we must not let any *other* threads in!\u001b[39;00m\n\u001b[1;32m 318\u001b[0m _tls\u001b[38;5;241m.\u001b[39mis_initializing \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
707846
"\u001b[0;31mRuntimeError\u001b[0m: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 500: named symbol not found"
@@ -1024,7 +1163,7 @@
10241163
},
10251164
{
10261165
"cell_type": "code",
1027-
"execution_count": 50,
1166+
"execution_count": 17,
10281167
"metadata": {},
10291168
"outputs": [
10301169
{
@@ -1052,7 +1191,7 @@
10521191
},
10531192
{
10541193
"cell_type": "code",
1055-
"execution_count": 51,
1194+
"execution_count": 18,
10561195
"metadata": {},
10571196
"outputs": [
10581197
{
@@ -1084,7 +1223,7 @@
10841223
},
10851224
{
10861225
"cell_type": "code",
1087-
"execution_count": 52,
1226+
"execution_count": 19,
10881227
"metadata": {},
10891228
"outputs": [
10901229
{
@@ -1118,7 +1257,7 @@
11181257
"\n",
11191258
"</style>\n",
11201259
"\n",
1121-
"<div id = \"x7a28caf1b6044e7c89e451a75c0ef22c\"> </div>\n",
1260+
"<div id = \"x34cf302f998c48d2a9a314fd81856883\"> </div>\n",
11221261
"<script charset=\"utf-8\" src=\"https://d3js.org/d3.v5.min.js\"></script>\n",
11231262
"<script charset=\"utf-8\">\n",
11241263
"// Load via requireJS if available (jupyter notebook environment)\n",
@@ -1150,8 +1289,8 @@
11501289
" }\n",
11511290
"};\n",
11521291
"require(['d3'], function(d3){ //START\n",
1153-
"const data = {\"edges\": [{\"uid\": \"a-b\", \"source\": \"a\", \"target\": \"b\", \"weight\": 1, \"color\": \"gray\"}, {\"uid\": \"b-c\", \"source\": \"b\", \"target\": \"c\", \"weight\": 1, \"color\": \"gray\"}, {\"uid\": \"c-a\", \"source\": \"c\", \"target\": \"a\", \"weight\": 1, \"color\": \"gray\"}], \"nodes\": [{\"uid\": \"a\", \"label\": \"a\"}, {\"uid\": \"b\", \"label\": \"b\"}, {\"uid\": \"c\", \"label\": \"c\"}]}\n",
1154-
"const config = {\"edge_color\": \"gray\", \"node_label\": [\"a\", \"b\", \"c\"], \"directed\": true, \"curved\": true, \"selector\": \"#x7a28caf1b6044e7c89e451a75c0ef22c\"}\n",
1292+
"const data = {\"edges\": [{\"uid\": \"a-b\", \"source\": \"a\", \"target\": \"b\", \"color\": \"gray\", \"weight\": 1}, {\"uid\": \"b-c\", \"source\": \"b\", \"target\": \"c\", \"color\": \"gray\", \"weight\": 1}, {\"uid\": \"c-a\", \"source\": \"c\", \"target\": \"a\", \"color\": \"gray\", \"weight\": 1}], \"nodes\": [{\"uid\": \"a\", \"label\": \"a\"}, {\"uid\": \"b\", \"label\": \"b\"}, {\"uid\": \"c\", \"label\": \"c\"}]}\n",
1293+
"const config = {\"edge_color\": \"gray\", \"node_label\": [\"a\", \"b\", \"c\"], \"directed\": true, \"curved\": true, \"selector\": \"#x34cf302f998c48d2a9a314fd81856883\"}\n",
11551294
"console.log(\"Static Network Template\");\n",
11561295
"/* Resources\n",
11571296
" https://bl.ocks.org/mapio/53fed7d84cd1812d6a6639ed7aa83868\n",
@@ -1732,7 +1871,7 @@
17321871
},
17331872
{
17341873
"cell_type": "code",
1735-
"execution_count": 77,
1874+
"execution_count": 20,
17361875
"metadata": {},
17371876
"outputs": [
17381877
{
@@ -1759,7 +1898,7 @@
17591898
},
17601899
{
17611900
"cell_type": "code",
1762-
"execution_count": 78,
1901+
"execution_count": 21,
17631902
"metadata": {},
17641903
"outputs": [
17651904
{

0 commit comments

Comments
 (0)