Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs/GIE] Add doc for getting started with GIE #2527

Merged
merged 5 commits into from
Mar 16, 2023
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
12 changes: 6 additions & 6 deletions docs/analytical_engine/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This guide gives you a quick start to use GraphScope for graph analysis tasks on

## Installation

We’ll start by installing GraphScope with a single-line command.
We’ll start by installing GraphScope with a single-line command.

```bash

Expand All @@ -22,9 +22,9 @@ python3 -m pip install graphscope --upgrade \
````


## Running GraphScope Analaytical Engine on Local
## Running GraphScope Analytical Engine on Local

The `graphscope` package includes everything you need to analysis a graph on your local machine.
The `graphscope` package includes everything you need to analysis a graph on your local machine.
Now you may import it in a Python session and start your job.

```python
Expand All @@ -34,11 +34,11 @@ from graphscope.dataset.modern_graph import load_modern_graph

gs.set_option(show_log=True)

# load the modern graph as example.
# load the modern graph as example.
# TODO: refers to modern graph description.
graph = load_modern_graph()

# triggers label propagation algorithm(LPA)
# triggers label propagation algorithm(LPA)
# on the modern graph(property graph) and print the result.
ret = gs.lpa(graph)
print(ret.to_dataframe(selector={'id': 'v.id', 'label': 'r'}))
Expand All @@ -59,4 +59,4 @@ Next, you may want to learn more about the following topics:

- [Design of the analytical engine of GraphScope and its technical details](analytical_engine/design_of_gae)
- [Disaggregate deployment of GraphScope on a k8s cluster for large-scale graph analysis](analytical_engine/deployment)
- [A set of examples with advanced usage, including customized algorithms, NetworkX/Giraph/GraphX compatibility, etc.](analytical_engine/guide_and_exmaples)
- [A set of examples with advanced usage, including customized algorithms, NetworkX/Giraph/GraphX compatibility, etc.](analytical_engine/guide_and_exmaples)
2 changes: 0 additions & 2 deletions docs/getting_started_gie.md

This file was deleted.

14 changes: 7 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and the vineyard store that offers efficient in-memory data transfers.
.. toctree::
:maxdepth: 2
:caption: Overview

overview/intro
overview/getting_started
overview/graph_analytics_workloads
Expand All @@ -44,24 +44,24 @@ and the vineyard store that offers efficient in-memory data transfers.
.. toctree::
:maxdepth: 2
:caption: Graph Analytical Engine

analytical_engine/getting_started
analytical_engine/deployment
analytical_engine/design_of_gae
analytical_engine/guide_and_examples
analytical_engine/dev_and_test
analytical_engine/apis
analytical_engine/faqs


.. toctree::
:maxdepth: 2
:caption: Graph Interactive Engine

getting_started_gie
design_of_gie
user_guide_and_examples_of_gie
faqs_of_gie
interactive_engine/getting_started
interactive_engine/design_of_gie
interactive_engine/user_guide_and_examples
interactive_engine/supported_gremlin_steps

.. toctree::
:maxdepth: 2
Expand Down
2 changes: 2 additions & 0 deletions docs/interactive_engine/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Deployment for GIE

File renamed without changes.
73 changes: 73 additions & 0 deletions docs/interactive_engine/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Getting Started

This guide gives you a quick start to use GraphScope for graph interactive tasks on your local machine.

## Installation

We’ll start by installing GraphScope with a single-line command.

```bash

python3 -m pip install graphscope --upgrade

```

````{tip}
If the download is very slow, try to use a mirror site for the pip.

```bash
python3 -m pip install graphscope --upgrade \
-i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
```
````

## Running GraphScope Interactive Engine on Local

It's fairly straightforward to run interactive queries using the `graphscope` package on
your local machine. First of all, you import `graphscope` in a Python session, and load
the modern graph, which has been widely used in [Tinkerpop](https://tinkerpop.apache.org/docs/3.6.2/tutorials/getting-started/) demos.


```python
import graphscope as gs
from graphscope.dataset.modern_graph import load_modern_graph

gs.set_option(show_log=True)

# load the modern graph as example.
graph = load_modern_graph()

# Hereafter, you can use the `graph` object to create an `gremlin` query session
g = gs.gremlin(graph)
# then `execute` any supported gremlin query.
q1 = g.execute('g.V().count()')
print(q1.all()) # should print [6]

q2 = g.execute('g.V().hasLabel(\'person\')')
print(q2.all()) # should print [[v[2], v[3], v[0], v[1]]]
```

You may see something like:
```Shell
...
... [INFO][coordinator:453]: Built interactive frontend xxx.xxx.xxx.xxx:pppp for graph xxx
... [INFO][op_executor:455]: execute gremlin query
[6]
...
... [INFO][op_executor:455]: execute gremlin query
[v[2], v[3], v[0], v[1]]
...
```

The number 6 is printed, which is the number of vertices in modern graph.


## What's the Next
As shown in the above example, it is very easy to use GraphScope to interactively query a graph using the gremlin query language on your local machine. You may find more tutorials [here](https://tinkerpop.apache.org/docs/current/tutorials/getting-started/) for the basic Gremlin usage, in which most read-only queries can be seamlessly executed with the above `g.execute()` function.

In addition to the above local-machine entr\'ee, we have prepared the following topics for your reference.

- GIE can process LDBC interactive complex workloads. [A walk-through tutorial is here](./ldbc_tutorial)
- GIE can work in a distributed environment to process very large graph. [How to do that?](./deployment)
- GIE has supported a lot of standard Gremlin steps, together with many useful syntactic sugars. [Please look into the details](./supported_gremlin_steps)
- Want to know more about the technical details of GIE. [This is the design and architecture of GIE](./design_of_gie)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Tutorials for Gremlin Users
# Supported Gremlin Steps
1. [Introduction](#introduction)
2. [Standard Steps](#standard-steps)
1. [Source](#source)
Expand Down Expand Up @@ -121,7 +121,7 @@ g.V().outE().bothV() # both endpoints of the outgoing edges
The hasId()-step is meant to filter graph elements based on their identifiers.

Parameters: </br>
elementIds - identifiers of the elements.
elementIds - identifiers of the elements.
```bash
g.V().hasId(1) # = g.V(1)
g.V().hasId(1,2,3) # = g.V(1,2,3)
Expand All @@ -130,7 +130,7 @@ g.V().hasId(1,2,3) # = g.V(1,2,3)
The hasLabel()-step is meant to filter graph elements based on their labels.

Parameters: </br>
labels - labels of the elements.
labels - labels of the elements.
```bash
g.V().hasLabel("person")
g.V().hasLabel("person", "software")
Expand All @@ -139,17 +139,17 @@ g.V().hasLabel("person", "software")
The has()-step is meant to filter graph elements by applying predicates on their properties.

Parameters: </br>
* propertyKey - the key of the property to filter on for existence.
* propertyKey - the key of the property to filter on for existence.
```bash
g.V().has("name") # find vertices containing property `name`
```
* propertyKey - the key of the property to filter on, </br> value - the value to compare the accessor value to for equality.
* propertyKey - the key of the property to filter on, </br> value - the value to compare the accessor value to for equality.
```bash
g.V().has("age", 10)
g.V().has("name", "marko")
g.E().has("weight", 1.0)
g.E().has("weight", 1.0)
```
* propertyKey - the key of the property to filter on, </br> predicate - the filter to apply to the key's value.
* propertyKey - the key of the property to filter on, </br> predicate - the filter to apply to the key's value.
```bash
g.V().has("age", P.eq(10))
g.V().has("age", P.neq(10))
Expand All @@ -169,11 +169,11 @@ Parameters: </br>
g.V().has("name", TextP.notEndingWith("rko"))
g.V().has("name", TextP.notContaining("ark"))
```
* label - the label of the Element, </br> propertyKey - the key of the property to filter on, </br> value - the value to compare the accessor value to for equality.
* label - the label of the Element, </br> propertyKey - the key of the property to filter on, </br> value - the value to compare the accessor value to for equality.
```bash
g.V().has("person", "id", 1) # = g.V().hasLabel("person").has("id", 1)
```
* label - the label of the Element, </br> propertyKey - the key of the property to filter on, </br> predicate - the filter to apply to the key's value.
* label - the label of the Element, </br> propertyKey - the key of the property to filter on, </br> predicate - the filter to apply to the key's value.
```bash
g.V().has("person", "age", P.eq(10)) # = g.V().hasLabel("person").has("age", P.eq(10))
```
Expand Down Expand Up @@ -329,7 +329,7 @@ Usages of the modulated by()-step: </br>
* empty - an identity() modulation.
```bash
# = g.V().as("a").select("a")
g.V().as("a").select("a").by()
g.V().as("a").select("a").by()
# = g.V().as("a").out().as("b").select("a", "b")
g.V().as("a").out().as("b").select("a", "b").by().by()
```
Expand Down Expand Up @@ -504,7 +504,7 @@ g.V().union(out(), out().out())
The match()-step provides a declarative form of graph patterns to match with. With match(), the user provides a collection of "sentences," called patterns, that have variables defined that must hold true throughout the duration of the match(). For most of the complex graph patterns, it is usually much easier to express via match() than with single-path traversals.

Parameters: </br>
matchSentences - define a collection of patterns. Each pattern consists of a start tag, a serials of gremlin steps (binders) and an end tag.
matchSentences - define a collection of patterns. Each pattern consists of a start tag, a serials of gremlin steps (binders) and an end tag.

Supported binders within a pattern: </br>
* Expand: in()/out()/both(), inE()/outE()/bothE(), inV()/outV()/otherV/bothV
Expand All @@ -523,7 +523,7 @@ An edge-induced subgraph extracted from the original graph.
Parameters: </br>
graphName - the name of the side-effect key that will hold the subgraph.
```bash
g.E().subgraph("all")
g.E().subgraph("all")
g.V().has('name', "marko").outE("knows").subgraph("partial")
```
## Syntactic Sugars
Expand All @@ -537,7 +537,7 @@ Expand a multiple-hops path along the outgoing edges, which length is within the
Parameters: </br>
lengthRange - the lower and the upper bounds of the path length, </br> edgeLabels - the edge labels to traverse.

Usages of the with()-step: </br>
Usages of the with()-step: </br>
keyValuePair - the options to configure the corresponding behaviors of the `PathExpand`-step.
```bash
# expand hops within the range of [1, 10) along the outgoing edges,
Expand All @@ -554,7 +554,7 @@ g.V().out("1..10", "knows")
# expand hops within the range of [1, 10) along the outgoing edges which label is `knows` or `created`,
# vertices can be duplicated and only the end vertex should be kept
g.V().out("1..10", "knows", "created")
```
```
Running Example:
```bash
gremlin> g.V().out("1..3", "knows").with('RESULT_OPT', 'ALL_V')
Expand Down Expand Up @@ -656,7 +656,7 @@ And related operations can be performed based on these entries, including:
```
* exponentiation
```bash
@.num ^^ 3
@.num ^^ 3
@.num ^^ -3
```

Expand Down Expand Up @@ -761,13 +761,13 @@ In graph pattern scenarios, `repeat().times()` can be replaced equivalently by t
```bash
# = g.V().out("2..3", "knows").endV()
g.V().repeat(out("knows")).times(2)

# = g.V().out("1..3", "knows").endV()
g.V().repeat(out("knows")).emit().times(2)

# = g.V().out("2..3", "knows").with('PATH_OPT', 'SIMPLE').endV()
g.V().repeat(out("knows").simplePath()).times(2)

# = g.V().out("1..3", "knows").with('PATH_OPT', 'SIMPLE').endV()
g.V().repeat(out("knows").simplePath()).emit().times(2)
```
Expand All @@ -784,4 +784,4 @@ It is required to maintain global variables for `SideEffect`-step during actual
#### branch
Currently, we only support the operations of merging multiple streams into one. The following splitting operations are unsupported:
* branch()
* choose()
* choose()
2 changes: 0 additions & 2 deletions docs/user_guide_and_examples_of_gie.md

This file was deleted.