Skip to content

Commit 60a5f40

Browse files
James review (#17)
* bump pyyaml version * remove open house event * auto update people list * remove people list * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * language level content review * Clarify discussion of event ordering docs/user-guide/persistent-graph/2_ambiguity.md * update hanging deletions examples * remove pyvis * update hanging deletions examples
1 parent 10e00ac commit 60a5f40

40 files changed

Lines changed: 459 additions & 510 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ package.json
1111
.jekyll-cache
1212
.tweet-cache/*
1313
.vscode
14-
.venv
14+
.venv
15+
*__pycache__

docs/index.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,19 @@ Below you can see an example of these APIs and the sort of questions you can ask
6161
```
6262

6363
### GraphQL Playground
64-
Once you have built some graphs, you can easily host them via Graphql. When you host a Raphtory GraphQL server you get a web playground bundled in, accessible on the same port within your browser (defaulting to 1736). Here you can experiment with queries on your graphs and explore the schema. An example of the playground can be seen below, running a similar query as in the python example above.
64+
Once you have built some graphs, you can easily host them via Graphql. When you host a Raphtory GraphQL server you also get a web playground. Here you can experiment with queries on your graphs and explore the schema. You can see an example of the playground below, running a similar query to the previous python example.
6565

6666
![GraphQL Playground](https://i.imgur.com/p0HH6v3.png)
6767

6868
### Graph Visualisation and Explorations
69-
Once the GraphQL server is running, you can access the UI directly. If the server is hosted on port 1736, the UI will be available at http://localhost:1736. The UI allows you to search for data in Raphtory, explore connections, and visualise the graph effortlessly.
70-
69+
Once the GraphQL server is running, you can access the UI directly. If the server is hosted on port `1736`, the UI will be available at `http://localhost:1736`. This interface allows you to search for data in Raphtory, explore connections, and visualise the graph effortlessly.
7170

7271
![Graph User Interface](https://github.com/user-attachments/assets/65aec644-edf8-4db6-a932-5b63228e9e0d)
7372

7473
## Excited to give it a go?
7574

7675
This site has been created to get new users of `Raphtory` up to speed by explaining the most important features via meaningful examples. You can get started straight away by heading to the [User Guide](user-guide/installation.md). If you prefer learning via APIs and reading into specific object or functions, your best best it to visit the API documentation: [Python](https://docs.raphtory.com/) | [Rust](https://docs.rs/raphtory/latest/raphtory/).
7776

78-
79-
8077
## Community
8178

8279
Join the growing community of open-source enthusiasts using Raphtory to power their graph analysis projects!
@@ -85,17 +82,13 @@ Join the growing community of open-source enthusiasts using Raphtory to power th
8582

8683
- Join our [![Slack](https://img.shields.io/badge/community-Slack-red)](https://join.slack.com/t/raphtory/shared_invite/zt-xbebws9j-VgPIFRleJFJBwmpf81tvxA) to chat with us and get answers to your questions!
8784

88-
--8<-- "docs/people.md"
89-
9085
### Sponsors
9186
[<img src="https://github.com/Pometry/Raphtory/assets/6665739/3953c945-e8b4-4b4b-a01a-dd595ffb06e9" style="height:75px"/>](https://www.pometry.com/)
9287

9388
## Contribute
9489

9590
The best way to start contributing is to give Raphtory a :star: on github! Once you have done that, if you want to raise an issue, submit a PR or give us some feedback, you can checkout our [Contributing Guide](https://github.com/Pometry/Raphtory/blob/master/CONTRIBUTING.md), the open [list of issues](https://github.com/Pometry/Raphtory/issues), or hit us up directly on [slack](https://join.slack.com/t/raphtory/shared_invite/zt-xbebws9j-VgPIFRleJFJBwmpf81tvxA).
9691

97-
98-
9992
## License
10093

10194
Raphtory is licensed under the terms of the GNU General Public License v3.0.

docs/open-house.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/people.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/src/python/getting-started/export.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -128,36 +128,3 @@
128128
nx.draw(nx_g, with_labels=True, node_color="lightblue", edge_color="gray")
129129

130130
# --8<-- [end:networkX_vis]
131-
132-
133-
# --8<-- [start:pyvis]
134-
import json
135-
136-
137-
pyvis_g = traffic_graph.to_pyvis(
138-
edge_weight="data_size_MB", edge_color="#8e9b9e", directed=True,notebook=False
139-
)
140-
141-
options = {
142-
"edges": {
143-
"scaling": {
144-
"min": 1,
145-
"max": 10,
146-
},
147-
},
148-
"physics": {
149-
"barnesHut": {
150-
"gravitationalConstant": -30000,
151-
"centralGravity": 0.3,
152-
"springLength": 100,
153-
"springConstant": 0.05,
154-
},
155-
"maxVelocity": 50,
156-
"timestep": 0.5,
157-
},
158-
}
159-
160-
pyvis_g.set_options(json.dumps(options))
161-
162-
pyvis_g.write_html("nx.html")
163-
# --8<-- [end:pyvis]

docs/src/python/getting-started/persistent-graph.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
G = PersistentGraph()
2424

2525
G.delete_edge(5, "Alice", "Bob")
26-
27-
print(G.edges.explode())
26+
print(f"G's edges are {G.edges.explode()}")
27+
G.add_edge(1, "Alice", "Bob")
28+
print(f"G's edges are {G.edges.explode()}")
2829
# --8<-- [end:hanging_deletions]
2930

3031
# --8<-- [start:behaviour_1]
@@ -44,13 +45,7 @@
4445
G1.add_edge(1, 1, 2, properties={"message":"hi"})
4546
G1.delete_edge(1, 1, 2)
4647

47-
G2 = PersistentGraph()
48-
49-
G2.delete_edge(1, 1, 2)
50-
G2.add_edge(1, 1, 2, properties={"message":"hi"})
51-
5248
print(f"G1's edges are {G1.edges.explode()}")
53-
print(f"G2's edges are {G2.edges.explode()}")
5449

5550
# --8<-- [end:behaviour_2]
5651

docs/user-guide/algorithms/1_intro.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Running algorithms
22

3-
Within Raphtory we have implemented many of the standard algorithms you may expect within a graph library, but have also added several temporal algorithms such as `Temporal Reachability` and `Temporal Motifs`.
3+
Raphtory implements many of the standard algorithms you expect within a graph library, but also has several temporal algorithms such as `Temporal Reachability` and `Temporal Motifs`.
44

5-
Before we look at the different types of algorithms, let's first load in some data. For these examples we are going to use the [One graph to rule them all](https://arxiv.org/abs/2210.07871) dataset, which maps the co-occurrence of characters within the Lord of The Rings books. This dataset is a simple edge list, consisting of the source character, destination character and the sentence they occurred together in (which we shall use as a timestamp). The dataframe for this can be seen in the output below.
5+
Raphtory categorizes algorithms into `graphwide` and `node centric` algorithms.
6+
7+
- `graphwide`: returns one value for the whole graph.
8+
9+
- `node centric`: returns one value for each node in the graph
10+
11+
For these examples we are going to use the [One graph to rule them all](https://arxiv.org/abs/2210.07871) dataset, which maps the co-occurrence of characters in the Lord of The Rings books.
12+
13+
This dataset is a simple edge list, consisting of the source character, destination character and the sentence they occurred together in (which we use as a timestamp). The dataframe for this can be seen in the output below.
614

715
{{code_block('getting-started/algorithms','data_loading',['Graph'])}}
816
!!! Output

docs/user-guide/algorithms/2_graph-algorithms.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Graph wide algorithms
2-
The first category of algorithms we can run are `graph wide`, returning one value for the whole graph. There are many useful metrics that fall into this category, of which we run three in the code below:
2+
3+
The following examples cover three `graphwide` algorithms:
34

45
* [Graph Density](https://en.wikipedia.org/wiki/Dense_graph) - which represents the ratio between the edges present in a graph and the maximum number of edges that the graph could contain.
56
* [Clustering coefficient](https://en.wikipedia.org/wiki/Clustering_coefficient) - which is a measure of the degree to which nodes in a graph tend to cluster together e.g. how many of your friends are also friends.
67
* [Reciprocity](https://en.wikipedia.org/wiki/Reciprocity_(network_science)) - which is a measure of the likelihood of nodes in a directed network to be mutually connected e.g. if you follow someone on twitter, whats the change of them following you back.
78

8-
As you can see below, to run an algorithm you simply need to import the algorithm package, choose an algorithm to run and hand it your graph.
9+
To run an algorithm you simply need to import the algorithm package, choose an algorithm to run, and give it your graph.
910

1011
{{code_block('getting-started/algorithms','global',['Graph'])}}
1112

docs/user-guide/algorithms/3_node-algorithms.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Node centric algorithms
2-
The second category of algorithms are `node centric` and return a value for each node in the graph. These results are stored within a `NodeState` object which has functions for sorting, grouping, top_k and conversion to dataframes. To demonstrate these functions below we have run [PageRank](https://en.wikipedia.org/wiki/PageRank) and [Weakly Connected Components](https://en.wikipedia.org/wiki/Component_(graph_theory)).
1+
# Node centric algorithms
32

4-
## Continuous Results (PageRank)
5-
`PageRank` is an centrality metric developed by Google's founders to rank web pages in search engine results based on their importance and relevance. This has since become a standard ranking algorithm for a whole host of other usecases.
3+
The second category of algorithms are `node centric` which return a value for each node in the graph. These results are stored within a `NodeState` object which has functions for sorting, grouping, top_k, and conversion to dataframes.
64

7-
Raphtory's implementation returns the score for each node - these are continuous values, meaning we can discover the most important characters in our Lord of the Rings dataset via `top_k()`.
5+
## Continuous Results: PageRank
86

9-
In the code below we first get the result of an individual character (Gandalf), followed by the values of the top 5 most important characters.
7+
[PageRank](https://en.wikipedia.org/wiki/PageRank) is an centrality metric developed by Google's founders to rank web pages in search engine results based on their importance and relevance. This has since become a standard ranking algorithm for a whole host of other usecases.
8+
9+
Raphtory's implementation returns the score for each node. These are **continuous values**, meaning we can discover the most important characters in our Lord of the Rings dataset via `top_k()`.
10+
11+
In the example below we first get the result of an individual character (Gandalf), followed by the values of the top 5 most important characters.
1012

1113
{{code_block('getting-started/algorithms','pagerank',['Graph'])}}
1214

@@ -16,23 +18,19 @@ In the code below we first get the result of an individual character (Gandalf),
1618
--8<-- "python/getting-started/algorithms.py:pagerank"
1719
```
1820

19-
## Discrete Results (Connected Components)
21+
## Discrete Results: Connected Components
2022

21-
`Weakly connected components` in a directed graph are `subgraphs` where every node is reachable from every other node (if edge direction is ignored).
23+
[Weakly connected components](https://en.wikipedia.org/wiki/Component_(graph_theory)) in a directed graph are `subgraphs` where every node is reachable from every other node if edge direction is ignored.
2224

23-
This algorithm returns the id of the component each node is a member of - these are discrete values, meaning we can use `groups` to find additional insights like the size of the [largest connected component](https://en.wikipedia.org/wiki/Giant_component).
24-
25-
In the code below we first run the algorithm and print the result so we can see what it looks like.
25+
For each node this algorithm finds which component it is a member of and returns the id of the component. These are **discrete values**, meaning we can use `groups` to find additional insights like the size of the [largest connected component](https://en.wikipedia.org/wiki/Giant_component).
2626

2727
!!! info
2828

2929
The `component ID (value)` is generated from the lowest `node ID` in the component.
3030

31-
Next we take the results and group the nodes by these IDs and calculate the size of the largest component.
32-
33-
!!! info
31+
In the example below we first run the algorithm and print the result so we can see what it looks like.
3432

35-
Almost all nodes are within this component (134 of the 139), as is typical for social networks.
33+
Next we take the results and group the nodes by these IDs and calculate the size of the largest component. Almost all nodes are within this component (134 of the 139), as is typical for social networks.
3634

3735
{{code_block('getting-started/algorithms','connectedcomponents',['Graph'])}}
3836

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Running algorithms on graph views
22

3-
As with all the queries we saw in the [previous chapter](../views/1_intro.md), both `graphwide` and `node centric` algorithms can be run on `graph views`. This allows us to see how results change over time, run algorithms on subsets of the layers or remove specific nodes from the graph to see the impact this has.
3+
Both `graphwide` and `node centric` algorithms can be run on `graph views`. This allows us to see how results change over time, run algorithms on subsets of the layers, or remove specific nodes from the graph to see the impact this has.
44

5-
To demonstrate this, below is an example of how you could track Gandaf's importance over the course of the story using rolling windows and the `PageRank` algorithm.
5+
To demonstrate this, the following example shows how you could track Gandalf's importance over the course of the story using rolling windows and the `PageRank` algorithm.
66

77
Within each windowed graph we use the `NodeState` api to extract Gandalf's score and record it alongside the earliest timestamp in the window, which can then be plotted via matplotlib.
88

9-
109
{{code_block('getting-started/algorithms','rolling',['Graph'])}}

0 commit comments

Comments
 (0)