| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "code", |
| 5 |
"execution_count": null, |
| 6 |
"id": "815a1030", |
| 7 |
"metadata": {}, |
| 8 |
"outputs": [], |
| 9 |
"source": [ |
| 10 |
"import numpy as np\n", |
| 11 |
"from bqplot import *\n", |
| 12 |
"\n", |
| 13 |
"node_data = [\n", |
| 14 |
" dict(shape='rect'),\n", |
| 15 |
" dict(label='B', shape='ellipse', label_display='outside'),\n", |
| 16 |
" dict(label='C', shape='ellipse'),\n", |
| 17 |
" dict(shape='rect'),\n", |
| 18 |
" 'E',\n", |
| 19 |
" 'F',\n", |
| 20 |
" dict(label='G', shape='ellipse'),\n", |
| 21 |
"]\n", |
| 22 |
"link_data = [\n", |
| 23 |
" {'source': 2, 'target': 5},\n", |
| 24 |
" {'source': 1, 'target': 2},\n", |
| 25 |
" {'source': 3, 'target': 6},\n", |
| 26 |
" {'source': 1, 'target': 5},\n", |
| 27 |
" {'source': 3, 'target': 0},\n", |
| 28 |
" {'source': 4, 'target': 1},\n", |
| 29 |
" {'source': 3, 'target': 6},\n", |
| 30 |
" {'source': 0, 'target': 2},\n", |
| 31 |
" {'source': 3, 'target': 6}\n", |
| 32 |
"]\n", |
| 33 |
"graph = Graph(node_data=node_data, link_data=link_data, charge=-600, static=True, colors=['orange'] * 7)\n", |
| 34 |
"Figure(marks=[graph])" |
| 35 |
] |
| 36 |
}, |
| 37 |
{ |
| 38 |
"cell_type": "code", |
| 39 |
"execution_count": null, |
| 40 |
"id": "0d74d719", |
| 41 |
"metadata": {}, |
| 42 |
"outputs": [], |
| 43 |
"source": [ |
| 44 |
"graph.directed = False" |
| 45 |
] |
| 46 |
}, |
| 47 |
{ |
| 48 |
"cell_type": "code", |
| 49 |
"execution_count": null, |
| 50 |
"id": "b0a6df4f", |
| 51 |
"metadata": {}, |
| 52 |
"outputs": [], |
| 53 |
"source": [ |
| 54 |
"graph.link_type = 'line'" |
| 55 |
] |
| 56 |
}, |
| 57 |
{ |
| 58 |
"cell_type": "code", |
| 59 |
"execution_count": null, |
| 60 |
"id": "af4a3a6f", |
| 61 |
"metadata": {}, |
| 62 |
"outputs": [], |
| 63 |
"source": [ |
| 64 |
"graph.directed = True" |
| 65 |
] |
| 66 |
}, |
| 67 |
{ |
| 68 |
"cell_type": "code", |
| 69 |
"execution_count": null, |
| 70 |
"id": "ec7ebdfe", |
| 71 |
"metadata": {}, |
| 72 |
"outputs": [], |
| 73 |
"source": [ |
| 74 |
"graph.link_type = 'slant_line'" |
| 75 |
] |
| 76 |
}, |
| 77 |
{ |
| 78 |
"cell_type": "code", |
| 79 |
"execution_count": null, |
| 80 |
"id": "e677884e", |
| 81 |
"metadata": {}, |
| 82 |
"outputs": [], |
| 83 |
"source": [ |
| 84 |
"graph.directed = False" |
| 85 |
] |
| 86 |
}, |
| 87 |
{ |
| 88 |
"cell_type": "code", |
| 89 |
"execution_count": null, |
| 90 |
"id": "7b534218", |
| 91 |
"metadata": {}, |
| 92 |
"outputs": [], |
| 93 |
"source": [ |
| 94 |
"# TOFIX\n", |
| 95 |
"# graph.colors = ['red'] * 7" |
| 96 |
] |
| 97 |
}, |
| 98 |
{ |
| 99 |
"cell_type": "code", |
| 100 |
"execution_count": null, |
| 101 |
"id": "b8ed2f4d", |
| 102 |
"metadata": {}, |
| 103 |
"outputs": [], |
| 104 |
"source": [ |
| 105 |
"# TOFIX\n", |
| 106 |
"# graph.node_data = list('ABCDEFG')" |
| 107 |
] |
| 108 |
} |
| 109 |
], |
| 110 |
"metadata": { |
| 111 |
"kernelspec": { |
| 112 |
"display_name": "Python 3", |
| 113 |
"language": "python", |
| 114 |
"name": "python3" |
| 115 |
}, |
| 116 |
"language_info": { |
| 117 |
"codemirror_mode": { |
| 118 |
"name": "ipython", |
| 119 |
"version": 3 |
| 120 |
}, |
| 121 |
"file_extension": ".py", |
| 122 |
"mimetype": "text/x-python", |
| 123 |
"name": "python", |
| 124 |
"nbconvert_exporter": "python", |
| 125 |
"pygments_lexer": "ipython3", |
| 126 |
"version": "3.9.2" |
| 127 |
} |
| 128 |
}, |
| 129 |
"nbformat": 4, |
| 130 |
"nbformat_minor": 5 |
| 131 |
} |