|
19 | 19 | }, |
20 | 20 | { |
21 | 21 | "cell_type": "code", |
22 | | - "execution_count": 1, |
| 22 | + "execution_count": null, |
23 | 23 | "metadata": {}, |
24 | 24 | "outputs": [], |
25 | 25 | "source": [ |
|
37 | 37 | }, |
38 | 38 | { |
39 | 39 | "cell_type": "code", |
40 | | - "execution_count": 2, |
| 40 | + "execution_count": null, |
41 | 41 | "metadata": {}, |
42 | 42 | "outputs": [], |
43 | 43 | "source": [ |
|
56 | 56 | }, |
57 | 57 | { |
58 | 58 | "cell_type": "code", |
59 | | - "execution_count": 3, |
| 59 | + "execution_count": null, |
60 | 60 | "metadata": {}, |
61 | | - "outputs": [ |
62 | | - { |
63 | | - "name": "stdout", |
64 | | - "output_type": "stream", |
65 | | - "text": [ |
66 | | - "Stats: {}\n" |
67 | | - ] |
68 | | - } |
69 | | - ], |
| 61 | + "outputs": [], |
70 | 62 | "source": [ |
71 | 63 | "create_graph_query = '''\n", |
72 | 64 | "MERGE (home:Page {name:'Home'})\n", |
|
108 | 100 | }, |
109 | 101 | { |
110 | 102 | "cell_type": "code", |
111 | | - "execution_count": 4, |
| 103 | + "execution_count": null, |
112 | 104 | "metadata": {}, |
113 | | - "outputs": [ |
114 | | - { |
115 | | - "data": { |
116 | | - "text/html": [ |
117 | | - "<div>\n", |
118 | | - "<style scoped>\n", |
119 | | - " .dataframe tbody tr th:only-of-type {\n", |
120 | | - " vertical-align: middle;\n", |
121 | | - " }\n", |
122 | | - "\n", |
123 | | - " .dataframe tbody tr th {\n", |
124 | | - " vertical-align: top;\n", |
125 | | - " }\n", |
126 | | - "\n", |
127 | | - " .dataframe thead th {\n", |
128 | | - " text-align: right;\n", |
129 | | - " }\n", |
130 | | - "</style>\n", |
131 | | - "<table border=\"1\" class=\"dataframe\">\n", |
132 | | - " <thead>\n", |
133 | | - " <tr style=\"text-align: right;\">\n", |
134 | | - " <th></th>\n", |
135 | | - " <th>page</th>\n", |
136 | | - " <th>score</th>\n", |
137 | | - " </tr>\n", |
138 | | - " </thead>\n", |
139 | | - " <tbody>\n", |
140 | | - " <tr>\n", |
141 | | - " <th>0</th>\n", |
142 | | - " <td>Home</td>\n", |
143 | | - " <td>3.233877</td>\n", |
144 | | - " </tr>\n", |
145 | | - " <tr>\n", |
146 | | - " <th>1</th>\n", |
147 | | - " <td>About</td>\n", |
148 | | - " <td>1.060435</td>\n", |
149 | | - " </tr>\n", |
150 | | - " <tr>\n", |
151 | | - " <th>2</th>\n", |
152 | | - " <td>Product</td>\n", |
153 | | - " <td>1.060435</td>\n", |
154 | | - " </tr>\n", |
155 | | - " <tr>\n", |
156 | | - " <th>3</th>\n", |
157 | | - " <td>Links</td>\n", |
158 | | - " <td>1.060435</td>\n", |
159 | | - " </tr>\n", |
160 | | - " <tr>\n", |
161 | | - " <th>4</th>\n", |
162 | | - " <td>Site A</td>\n", |
163 | | - " <td>0.329035</td>\n", |
164 | | - " </tr>\n", |
165 | | - " <tr>\n", |
166 | | - " <th>5</th>\n", |
167 | | - " <td>Site B</td>\n", |
168 | | - " <td>0.329035</td>\n", |
169 | | - " </tr>\n", |
170 | | - " <tr>\n", |
171 | | - " <th>6</th>\n", |
172 | | - " <td>Site C</td>\n", |
173 | | - " <td>0.329035</td>\n", |
174 | | - " </tr>\n", |
175 | | - " <tr>\n", |
176 | | - " <th>7</th>\n", |
177 | | - " <td>Site D</td>\n", |
178 | | - " <td>0.329035</td>\n", |
179 | | - " </tr>\n", |
180 | | - " </tbody>\n", |
181 | | - "</table>\n", |
182 | | - "</div>" |
183 | | - ], |
184 | | - "text/plain": [ |
185 | | - " page score\n", |
186 | | - "0 Home 3.233877\n", |
187 | | - "1 About 1.060435\n", |
188 | | - "2 Product 1.060435\n", |
189 | | - "3 Links 1.060435\n", |
190 | | - "4 Site A 0.329035\n", |
191 | | - "5 Site B 0.329035\n", |
192 | | - "6 Site C 0.329035\n", |
193 | | - "7 Site D 0.329035" |
194 | | - ] |
195 | | - }, |
196 | | - "execution_count": 4, |
197 | | - "metadata": {}, |
198 | | - "output_type": "execute_result" |
199 | | - } |
200 | | - ], |
| 105 | + "outputs": [], |
201 | 106 | "source": [ |
202 | 107 | "streaming_query = \"\"\"\n", |
203 | 108 | "CALL algo.pageRank.stream('Page', 'LINKS', {iterations:20, dampingFactor:0.85})\n", |
|
223 | 128 | }, |
224 | 129 | { |
225 | 130 | "cell_type": "code", |
226 | | - "execution_count": 5, |
| 131 | + "execution_count": null, |
227 | 132 | "metadata": {}, |
228 | | - "outputs": [ |
229 | | - { |
230 | | - "data": { |
231 | | - "text/html": [ |
232 | | - "<style>\n", |
233 | | - ".output_wrapper, .output {\n", |
234 | | - " height:auto !important;\n", |
235 | | - " max-height:600px;\n", |
236 | | - "}\n", |
237 | | - ".output_scroll {\n", |
238 | | - " box-shadow:none !important;\n", |
239 | | - " webkit-box-shadow:none !important;\n", |
240 | | - "}\n", |
241 | | - "</style>" |
242 | | - ], |
243 | | - "text/plain": [ |
244 | | - "<IPython.core.display.HTML object>" |
245 | | - ] |
246 | | - }, |
247 | | - "metadata": {}, |
248 | | - "output_type": "display_data" |
249 | | - } |
250 | | - ], |
| 133 | + "outputs": [], |
251 | 134 | "source": [ |
252 | 135 | "%%html\n", |
253 | 136 | "<style>\n", |
|
264 | 147 | }, |
265 | 148 | { |
266 | 149 | "cell_type": "code", |
267 | | - "execution_count": 8, |
| 150 | + "execution_count": null, |
268 | 151 | "metadata": {}, |
269 | | - "outputs": [ |
270 | | - { |
271 | | - "data": { |
272 | | - "text/html": [ |
273 | | - "\n", |
274 | | - " <iframe\n", |
275 | | - " width=\"100%\"\n", |
276 | | - " height=\"300px\"\n", |
277 | | - " src=\"figure/graph-42f172d7-37c2-4d64-bf22-122fad03b596.html\"\n", |
278 | | - " frameborder=\"0\"\n", |
279 | | - " allowfullscreen\n", |
280 | | - " ></iframe>\n", |
281 | | - " " |
282 | | - ], |
283 | | - "text/plain": [ |
284 | | - "<IPython.lib.display.IFrame at 0x1016ee940>" |
285 | | - ] |
286 | | - }, |
287 | | - "execution_count": 8, |
288 | | - "metadata": {}, |
289 | | - "output_type": "execute_result" |
290 | | - } |
291 | | - ], |
| 152 | + "outputs": [], |
292 | 153 | "source": [ |
293 | 154 | "from scripts.vis import generate_vis\n", |
294 | | - "generate_vis(host, user, password, \"MATCH (p1:Page)-[r:LINKS]->(p2:Page) RETURN *\")\n" |
| 155 | + "\n", |
| 156 | + "query = \"MATCH (p1:Page)-[r:LINKS]->(p2:Page) RETURN *\"\n", |
| 157 | + "labels_json = {'Page': {'caption': 'name', 'size': 'pagerank'}}\n", |
| 158 | + "relationships_json = {'LINKS': {'thickness': 'weight', 'caption': False}}\n", |
| 159 | + "\n", |
| 160 | + "generate_vis(host, user, password, query, labels_json, relationships_json)\n" |
295 | 161 | ] |
296 | 162 | } |
297 | 163 | ], |
298 | | - "metadata": { |
299 | | - "kernelspec": { |
300 | | - "display_name": "Python 3", |
301 | | - "language": "python", |
302 | | - "name": "python3" |
303 | | - }, |
304 | | - "language_info": { |
305 | | - "codemirror_mode": { |
306 | | - "name": "ipython", |
307 | | - "version": 3 |
308 | | - }, |
309 | | - "file_extension": ".py", |
310 | | - "mimetype": "text/x-python", |
311 | | - "name": "python", |
312 | | - "nbconvert_exporter": "python", |
313 | | - "pygments_lexer": "ipython3", |
314 | | - "version": "3.6.0" |
315 | | - } |
316 | | - }, |
| 164 | + "metadata": {}, |
317 | 165 | "nbformat": 4, |
318 | 166 | "nbformat_minor": 2 |
319 | 167 | } |
0 commit comments