Skip to content

Commit 5336776

Browse files
committed
Update README.md
1 parent 176d9bb commit 5336776

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ data.
153153
| 2 | Find **all possible** direct or indirect `Transfer` flows/paths **from** an account owned by George **to** to an account owned by `[email protected]` (This person's name is "Edward"). For indirect transfers, only find those up to length 5. <br>**Hint:** Specify variable-length or [recursive](https://docs.kuzudb.com/cypher/query-clauses/match/#match-variable-lengthrecursive-relationships) relationships in Cypher using the Kleene star operator `*` followed by the min and max length for the paths.
154154
| 3a | Find a **shortest** `Transfer` path **from** George's account to Edward's account. <br>**Hint:** Kùzu's Cypher dialect has a native clause to match [a single shortest path](https://docs.kuzudb.com/cypher/query-clauses/match/#single-shortest-path).
155155
| 3b | Find **all shortest** `Transfer` paths **from** George's account to Edward's account. <br>**Hint:** Kùzu's Cypher dialect has a native clause to match [all shortest paths](https://docs.kuzudb.com/cypher/query-clauses/match/#all-shortest-paths).
156-
| 4 | Find **all** indirect connections of **any type** between the `Person` nodes representing George and Edward up to length 4. We are searching for any possible paths, i.e., the labels of the edges do not have to be only `Owns` or `Transfer`; they can also be `LivesIn` as well. That is, the path between the two people can consist of any sequence of _any_ labels. Further, we also do not need the connections to be in a particular direction. <br>**Hint:** Use Cypher's flexible relationship matching using [multiple labels](https://docs.kuzudb.com/cypher/query-clauses/match/#match-relationships-with-multi-labels) or [any labels](https://docs.kuzudb.com/cypher/query-clauses/match/#match-relationships-with-any-label). Also use the undirected relationship patterns.
156+
| 4 | Find **all** indirect connections of **any type** between the `Person` nodes representing George and Edward up to length 5. We are searching for any possible paths, i.e., the labels of the edges do not have to be only `Owns` or `Transfer`; they can also be `LivesIn` as well. That is, the path between the two people can consist of any sequence of _any_ labels. Further, we also do not need the connections to be in a particular direction. <br>**Hint:** Use Cypher's flexible relationship matching using [multiple labels](https://docs.kuzudb.com/cypher/query-clauses/match/#match-relationships-with-multi-labels) or [any labels](https://docs.kuzudb.com/cypher/query-clauses/match/#match-relationships-with-any-label). Also use the undirected relationship patterns for the `-[:Transfer]-` to avoid getting an empty result.
157157
| 5 | **a)** Find the account that has the highest number of incoming transactions. <br>**Hint:** Use [group by and aggregate](https://docs.kuzudb.com/cypher/query-clauses/return/#group-by-and-aggregations) to *count* of incoming edges. For reference, all possible aggregate functions are [here](https://docs.kuzudb.com/cypher/expressions/aggregate-functions/). <br> **b)** Find an important account that has received the most dollars. <br>**Hint:** Do a [group by and aggregate](https://docs.kuzudb.com/cypher/query-clauses/return/#group-by-and-aggregations) to *sum* of the amounts on the incoming edges.
158158
| 6 | Find the accounts that are the "most central" using a graph algorithm. We will use the notion of highest “betweenness centrality” (BC). <br> **Note:** This part will be done in Python via the NetworkX library.
159159

python/networkx_example.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"import pandas as pd\n",
4949
"import networkx as nx\n",
5050
"\n",
51-
"db = kuzu.Database(\"../ex_db_kuzu\")\n",
51+
"db = kuzu.Database(\"../ex_kuzu_db\")\n",
5252
"conn = kuzu.Connection(db)\n",
5353
"kuzu.__version__"
5454
]
@@ -111,12 +111,12 @@
111111
" <tr>\n",
112112
" <th>0</th>\n",
113113
" <td>1</td>\n",
114-
" <td>0.029412</td>\n",
114+
" <td>0.023420</td>\n",
115115
" </tr>\n",
116116
" <tr>\n",
117117
" <th>1</th>\n",
118118
" <td>5</td>\n",
119-
" <td>0.062092</td>\n",
119+
" <td>0.054466</td>\n",
120120
" </tr>\n",
121121
" <tr>\n",
122122
" <th>2</th>\n",
@@ -139,8 +139,8 @@
139139
],
140140
"text/plain": [
141141
" id betweenness_centrality\n",
142-
"0 1 0.029412\n",
143-
"1 5 0.062092\n",
142+
"0 1 0.023420\n",
143+
"1 5 0.054466\n",
144144
"2 3 0.153595\n",
145145
"3 2 0.000000\n",
146146
"4 9 0.091503"
@@ -208,31 +208,31 @@
208208
" <tr>\n",
209209
" <th>0</th>\n",
210210
" <td>069392555</td>\n",
211-
" <td>5392.0</td>\n",
212-
" <td>0.450980</td>\n",
211+
" <td>5392</td>\n",
212+
" <td>0.428649</td>\n",
213213
" </tr>\n",
214214
" <tr>\n",
215215
" <th>1</th>\n",
216216
" <td>082388575</td>\n",
217-
" <td>6841.0</td>\n",
217+
" <td>6841</td>\n",
218218
" <td>0.235294</td>\n",
219219
" </tr>\n",
220220
" <tr>\n",
221221
" <th>2</th>\n",
222222
" <td>040162526</td>\n",
223-
" <td>7115.0</td>\n",
224-
" <td>0.202614</td>\n",
223+
" <td>7115</td>\n",
224+
" <td>0.180283</td>\n",
225225
" </tr>\n",
226226
" <tr>\n",
227227
" <th>3</th>\n",
228228
" <td>067853119</td>\n",
229-
" <td>5251.0</td>\n",
229+
" <td>5251</td>\n",
230230
" <td>0.176471</td>\n",
231231
" </tr>\n",
232232
" <tr>\n",
233233
" <th>4</th>\n",
234234
" <td>080785523</td>\n",
235-
" <td>8044.0</td>\n",
235+
" <td>8044</td>\n",
236236
" <td>0.153595</td>\n",
237237
" </tr>\n",
238238
" </tbody>\n",
@@ -241,11 +241,11 @@
241241
],
242242
"text/plain": [
243243
" account_id balance betweenness_centrality\n",
244-
"0 069392555 5392.0 0.450980\n",
245-
"1 082388575 6841.0 0.235294\n",
246-
"2 040162526 7115.0 0.202614\n",
247-
"3 067853119 5251.0 0.176471\n",
248-
"4 080785523 8044.0 0.153595"
244+
"0 069392555 5392 0.428649\n",
245+
"1 082388575 6841 0.235294\n",
246+
"2 040162526 7115 0.180283\n",
247+
"3 067853119 5251 0.176471\n",
248+
"4 080785523 8044 0.153595"
249249
]
250250
},
251251
"execution_count": 7,
@@ -312,7 +312,7 @@
312312
" <tr>\n",
313313
" <th>0</th>\n",
314314
" <td>Amanda</td>\n",
315-
" <td>0.450980</td>\n",
315+
" <td>0.428649</td>\n",
316316
" </tr>\n",
317317
" <tr>\n",
318318
" <th>1</th>\n",
@@ -322,7 +322,7 @@
322322
" <tr>\n",
323323
" <th>2</th>\n",
324324
" <td>Jon</td>\n",
325-
" <td>0.202614</td>\n",
325+
" <td>0.180283</td>\n",
326326
" </tr>\n",
327327
" <tr>\n",
328328
" <th>3</th>\n",
@@ -340,9 +340,9 @@
340340
],
341341
"text/plain": [
342342
" person bc\n",
343-
"0 Amanda 0.450980\n",
343+
"0 Amanda 0.428649\n",
344344
"1 Edward 0.235294\n",
345-
"2 Jon 0.202614\n",
345+
"2 Jon 0.180283\n",
346346
"3 Michael 0.176471\n",
347347
"4 Carol 0.153595"
348348
]

0 commit comments

Comments
 (0)