Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/content/docs/tutorials/example-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ The dataset used in the tutorials is a social network dataset of users and posts

## Download the data

You can download the zipped data by clicking on [this link](https://lbugdb.github.io/data/tutorial/tutorial_data.zip),
You can download the zipped data by clicking on [this link](https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip),
or use curl as shown below. Once downloaded, unzip the files to your current working directory.
```bash
curl -o tutorial_data.zip https://lbugdb.github.io/data/tutorial/tutorial_data.zip
curl -o tutorial_data.zip https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip
unzip tutorial_data.zip
```

Expand Down
6 changes: 6 additions & 0 deletions src/content/docs/tutorials/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ description="Tutorial for Ladybug's Python API"
href="/tutorials/python"
/>

<LinkCard
title="Python tutorial notebook"
description="Run the same social network tutorial as a Jupyter notebook"
href="https://github.com/LadybugDB/ladybug-icebug-notebooks/blob/main/ladybug-python-social-network.ipynb"
/>

### Colab notebooks

We've compiled a series of Google Colab
Expand Down
18 changes: 11 additions & 7 deletions src/content/docs/tutorials/python/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ source .venv/bin/activate
pip install ladybug
```

Next, [download the zipped data](https://lbugdb.github.io/data/tutorial/tutorial_data.zip) and unzip the files.
Next, [download the zipped data](https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip) and unzip the files.
```bash
curl -o tutorial_data.zip https://lbugdb.github.io/data/tutorial/tutorial_data.zip
curl -o tutorial_data.zip https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip
unzip tutorial_data.zip
rm tutorial_data.zip
```
Expand Down Expand Up @@ -217,10 +217,10 @@ LIMIT 5
```
```
['u2.username', 'follower_count']
['darkdog878', 6]
['epicking81', 3]
['fastgirl798', 4]
['mysticwolf198', 4]
['stormcat597', 2]
['coolking201', 3]
['brightninja683', 5]
['epiccat105', 4]
```

Expand All @@ -237,11 +237,11 @@ LIMIT 1
```
```
['u2.username', 'follower_count']
['stormninja678', 6]
['darkdog878', 6]
```

This dataset has multiple users with the greatest follower count of `6`. So, we are
excluding other users with the same follower count as `stormninja678` (or whoever appeared first).
excluding other users with the same follower count as `darkdog878` (or whoever appeared first).
If you want to retrieve all of them, the query becomes a bit longer:
```cypher
MATCH (u1:User)-[f:FOLLOWS]->(u2:User)
Expand All @@ -252,6 +252,10 @@ WITH u2, COUNT(u1) as follower_count, max_count
WHERE follower_count = max_count
RETURN u2.username, follower_count
```
```
['stormninja678', 6]
['darkdog878', 6]
```

### Q2: What is the shortest path between two users?
We might also be interested in finding the shortest path between two users. For example, how
Expand Down
21 changes: 13 additions & 8 deletions src/content/docs/tutorials/rust/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ cd lbug_social_network
cargo add lbug
```

Next, [download the zipped data](https://lbugdb.github.io/data/tutorial/tutorial_data.zip) and unzip the files.
Next, [download the zipped data](https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip) and unzip the files.
```bash
curl -o tutorial_data.zip https://lbugdb.github.io/data/tutorial/tutorial_data.zip
curl -o tutorial_data.zip https://huggingface.co/datasets/ladybugdb/python-tutorial/resolve/main/tutorial_data.zip
unzip tutorial_data.zip
rm tutorial_data.zip
```
Expand Down Expand Up @@ -234,11 +234,11 @@ println!("{}", result2);
Returns
```
u2.username|follower_count
coolwolf752|3
stormfox762|5
mysticwolf198|4
stormcat597|2
coolking201|3
brightninja683|5
stormqueen831|4
epiccat105|4
```
This is a lot more useful! We can now clearly see how many followers each user has.

Expand All @@ -256,11 +256,11 @@ println!("{}", result3);
Returns:
```
u2.username|follower_count
stormninja678|6
darkdog878|6
```

This dataset has multiple users with the greatest follower count of `6`. So, we are
excluding other users with the same follower count as `stormninja678` (or whoever appeared first).
excluding other users with the same follower count as `darkdog878` (or whoever appeared first).
If you want to retrieve all of them, the query becomes a bit longer:
```cypher
MATCH (u1:User)-[f:FOLLOWS]->(u2:User)
Expand All @@ -271,6 +271,11 @@ WITH u2, COUNT(u1) as follower_count, max_count
WHERE follower_count = max_count
RETURN u2.username, follower_count
```
```
u2.username|follower_count
stormninja678|6
darkdog878|6
```

### Q2: What is the shortest path between two users?
We might also be interested in finding the shortest path between two users.
Expand Down Expand Up @@ -507,4 +512,4 @@ fn main() -> Result<(), Error> {
```
</TabItem>

</Tabs>
</Tabs>
Loading