Skip to content

Commit

Permalink
Fixes the docstring rendering for GAE apps (#2131)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <sighingnow@gmail.com>
  • Loading branch information
sighingnow committed Oct 12, 2022
1 parent 950ed7a commit 6d5d288
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 53 deletions.
2 changes: 1 addition & 1 deletion coordinator/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ max-complexity = 18
# for flake8-quotes
inline-quotes = double
# for flake8-comprehensions
extend-ignore = E203,E402,F401,F401,F403,C4
extend-ignore = E203,E402,F401,F401,F403,C4,N802,N806
extend-exclude =
*_pb2.py
*_pb2_grpc.py
Expand Down
9 changes: 6 additions & 3 deletions docs/analytics_engine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,30 @@ property graph or not is described in its docstring.

.. autosummary::

- :func:`attribute_assortativity_coefficient`
- :func:`numeric_assortativity_coefficient`
- :func:`average_degree_connectivity`
- :func:`average_shortest_path_length`
- :func:`attribute_assortativity_coefficient`
- :func:`bfs`
- :func:`avg_clustering`
- :func:`clustering`
- :func:`degree_centrality`
- :func:`degree_assortativity_coefficient`
- :func:`degree_centrality`
- :func:`eigenvector_centrality`
- :func:`hits`
- :func:`is_simple_path`
- :func:`k_core`
- :func:`k_shell`
- :func:`katz_centrality`
- :func:`louvain`
- :func:`cdlp`
- :func:`lpa`
- :func:`numeric_assortativity_coefficient`
- :func:`lpa_u2i`
- :func:`pagerank`
- :func:`pagerank_nx`
- :func:`sssp`
- :func:`triangles`
- :func:`voterank`
- :func:`wcc`

The list is continuously growing.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ First, you need to ``git clone`` the latest version of code from our `repo <http
and run the command:

.. code:: bash
cd GraphScope
./scripts/install_deps.sh --dev
# With argument --cn to speed up the download if you are in China.
./scripts/install_deps.sh --dev --cn
The `install_deps.sh` does not install the grape-jdk dependency `fastFFI` by default.
If you don't care about `grape jdk <https://github.com/alibaba/GraphScope/blob/main/analytical_engine/java/README.md>`,
you can ignore this phase. But if you want to use the grape jdk of GraphScope,
Expand Down
2 changes: 2 additions & 0 deletions docs/interactive_engine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ Currently GIE supports the following Gremlin steps:
g.V().values("age").sum()
- Match step, e.g.,

.. code:: java
g.V().match(
__.as('a').out().as('b'),
__.as('b').out().as('c')
Expand Down
20 changes: 15 additions & 5 deletions docs/reference/app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,28 @@ Functions
BuiltIn apps
------------

.. autofunction:: graphscope.attribute_assortativity_coefficient
.. autofunction:: graphscope.numeric_assortativity_coefficient
.. autofunction:: graphscope.average_degree_connectivity
.. autofunction:: graphscope.average_shortest_path_length
.. autofunction:: graphscope.bfs
.. autofunction:: graphscope.pagerank
.. autofunction:: graphscope.sssp
.. autofunction:: graphscope.wcc
.. autofunction:: graphscope.avg_clustering
.. autofunction:: graphscope.clustering
.. autofunction:: graphscope.degree_assortativity_coefficient
.. autofunction:: graphscope.degree_centrality
.. autofunction:: graphscope.eigenvector_centrality
.. autofunction:: graphscope.hits
.. autofunction:: graphscope.is_simple_path
.. autofunction:: graphscope.k_core
.. autofunction:: graphscope.k_shell
.. autofunction:: graphscope.katz_centrality
.. autofunction:: graphscope.louvain
.. autofunction:: graphscope.cdlp
.. autofunction:: graphscope.lpa
.. autofunction:: graphscope.lpa_u2i
.. autofunction:: graphscope.pagerank
.. autofunction:: graphscope.pagerank_nx
.. autofunction:: graphscope.sssp
.. autofunction:: graphscope.triangles
.. autofunction:: graphscope.louvain

.. autofunction:: graphscope.voterank
.. autofunction:: graphscope.wcc
2 changes: 0 additions & 2 deletions docs/reference/gnn_engine/data_loader_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ orders** as specified in the above tables.
2 Data source type
==================

.. container::

The system abstracts the data access layer to allow easy connection to
multiple types of data sources. Currently, it supports LocalFileSystem.
If it is used on the Alibaba Cloud PAI platform, you can directly read
Expand Down
8 changes: 0 additions & 8 deletions docs/reference/gnn_engine/gsl_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ For example, in the heterogeneous graph shown below, start from a ‘user’
vertex, sample its one-hop neighbors along the ‘u2i’ edge, and then
sample its two-hop neighbors along the ‘i2i’ edge.
.. container::
.. code:: python
g.V("user").batch(64) # (1) randomly get 64 'user' vertices
Expand All @@ -297,8 +295,6 @@ general, this kind of sampling is often used for unsupervised learning,
which uses the edges as positive samples, and then samples the source
vertices of the edges as negative samples.
.. container::
.. code:: python
g.E("u2i").batch(64) # (1) randomly get 64 'u2i' edges
Expand All @@ -309,8 +305,6 @@ When the edge is undirected, one can conduct circular sampling by
``outV()`` and ``inV()``. The source and destination vertices are
neighbors of each other.
.. container::
.. code:: python
g.V("user").batch(64) # (1) randomly get 64 'user' vertex
Expand Down Expand Up @@ -345,8 +339,6 @@ one-hop neighbors (aggregating neighborhood information to the central
node). The item vertex is encoded in a similar way. An example is shown
below.
.. container::
.. code:: python
g.E("u2i").shuffle().batch(512) # (1) randomly get 512 u2i edegs
Expand Down
3 changes: 1 addition & 2 deletions docs/reference/networkx/transformation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _transformation:

Graph Transformation
^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^

In GraphScope, :class:`nx.Graph` or :class:`nx.DiGraph` can be created from GraphScope graph object.
We implement a copy-on-write transformation strategy for creating from GraphScope graph.
Expand Down Expand Up @@ -40,5 +40,4 @@ Note: :class:`nx.Graph` and :class:`nx.DiGraph` not support to be created from a
.. autofunction:: graphscope.nx.Graph.__init__
.. autofunction:: graphscope.nx.Graph._init_with_arrow_property_graph
.. autofunction:: graphscope.nx.Graph._convert_arrow_to_dynamic
29 changes: 25 additions & 4 deletions docs/reference/operation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Operation object
Operation.key
Operation.signature
Operation.eval
Operation.set_output
Operation.evaluated

BuiltIn operations
Expand All @@ -28,21 +27,43 @@ BuiltIn operations
:toctree: generated/

create_app
bind_app
run_app
create_graph
create_loader
add_labels_to_graph
dynamic_to_arrow
arrow_to_dynamic
modify_edges
modify_vertices
run_app
report_graph
project_arrow_property_graph
project_arrow_property_graph_to_simple
project_dynamic_property_graph
project_to_simple
copy_graph
to_directed
to_undirected
create_graph_view
clear_graph
clear_edges
create_subgraph
create_unload_op
unload_app
unload_graph
unload_context
context_to_numpy
context_to_dataframe
to_vineyard_tensor
to_vineyard_dataframe
to_data_sink
output
get_context_data
add_column
graph_to_numpy
graph_to_dataframe
create_interactive_query
create_learning_instance
close_interactive_query
close_learning_instance
gremlin_query
gremlin_to_subgraph
fetch_gremlin_result
9 changes: 6 additions & 3 deletions docs/zh/analytics_engine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,30 @@ GraphScope 图分析引擎内置了许多常用的图分析算法,包括连通

.. autosummary::

- :func:`attribute_assortativity_coefficient`
- :func:`numeric_assortativity_coefficient`
- :func:`average_degree_connectivity`
- :func:`average_shortest_path_length`
- :func:`attribute_assortativity_coefficient`
- :func:`bfs`
- :func:`avg_clustering`
- :func:`clustering`
- :func:`degree_centrality`
- :func:`degree_assortativity_coefficient`
- :func:`degree_centrality`
- :func:`eigenvector_centrality`
- :func:`hits`
- :func:`is_simple_path`
- :func:`k_core`
- :func:`k_shell`
- :func:`katz_centrality`
- :func:`louvain`
- :func:`cdlp`
- :func:`lpa`
- :func:`numeric_assortativity_coefficient`
- :func:`lpa_u2i`
- :func:`pagerank`
- :func:`pagerank_nx`
- :func:`sssp`
- :func:`triangles`
- :func:`voterank`
- :func:`wcc`

算法的支持列表会随着不断增加持续更新中。
Expand Down
8 changes: 5 additions & 3 deletions docs/zh/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Coordinator 作为 GraphScope 后端服务的入口,通过 grpc 接收来自 P


使用Helm部署GraphScope
--------------------
---------------------

获取并添加仓库信息

Expand Down Expand Up @@ -84,7 +84,8 @@ Coordinator 作为 GraphScope 后端服务的入口,通过 grpc 接收来自 P


在AWS/阿里云上部署集群
------------------------
-------------------

我们提供了一个可在AWS或阿里云上创建 Kubernetes 集群的交互式脚本。这一脚本可以帮助用户使用已有的集群或创建新的 Kubernetes 集群,然后输出集群的配置文件。
用法如下。你也可以通过 `./scripts/launch_cluster.py --help` 获得更详细的帮助信息。

Expand All @@ -102,7 +103,8 @@ Coordinator 作为 GraphScope 后端服务的入口,通过 grpc 接收来自 P
本地部署GraphScope
----------------------
-----------------

我们提供了一个可在本地安装GraphScope相关依赖的脚本,该脚本可以运行在 Ubuntu 20.04+ 或 MacOS 11.2+ 平台上, 主要的用法如下:
你可以通过 `./scripts/install_deps.sh -h` 获取更详细的帮助信息。

Expand Down
1 change: 0 additions & 1 deletion python/graphscope/analytical/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# limitations under the License.
#


# fmt: off
from graphscope.analytical.app.attribute_assortativity import \
attribute_assortativity_coefficient
Expand Down
7 changes: 4 additions & 3 deletions python/graphscope/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,16 @@ def __init__(self, session, op):

def load_app(gar=None, algo=None, context=None, **kwargs):
"""Load an app from gar.
bytes or the resource of the specified path or bytes.
Args:
algo: str
Algo name inside resource. None will extract name from gar resource
if there is only one app in it.
gar: bytes or BytesIO or str
str represent the path of resource.
for java apps, gar can be none to indicate we should find the app in
str represent the path of resource, bytes or the resource of the
specified path or bytes.
For java apps, gar can be none to indicate we should find the app in
previouse added libs.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion python/graphscope/framework/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BaseContextDAGNode(DAGNode):
"""Base class of concrete context DAG node.
In GraphScope, it will return a instance of concrete class `ContextDAGNode`
after evaluating an app, that will be automatically executed by :method:`sess.run`
after evaluating an app, that will be automatically executed by :meth:`Session.run`
in eager mode and return a instance of :class:`graphscope.framework.context.Context`
We can further use the handle to retrieve data:
Expand Down
33 changes: 21 additions & 12 deletions python/graphscope/framework/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class GraphDAGNode(DAGNode, GraphInterface):
In GraphScope, all operations that generate a new graph will return
a instance of :class:`GraphDAGNode`, which will be automatically
executed by :method:`sess.run` in `eager` mode.
executed by :meth:`Session.run` in `eager` mode.
The following example demonstrates its usage:
Expand Down Expand Up @@ -233,10 +233,12 @@ def __init__(
session (:class:`Session`): A graphscope session instance.
incoming_data: Graph can be initialized through various type of sources,
which can be one of:
- :class:`graphscope.framework.operation.Operation`
- :class:`graphscope.nx.Graph`
- :class:`graphscope.Graph`
- :class:`vineyard.Object`, :class:`vineyard.ObjectId` or :class:`vineyard.ObjectName`
- :class:`graphscope.framework.operation.Operation`
- :class:`graphscope.nx.Graph`
- :class:`graphscope.Graph`
- :class:`vineyard.Object`, :class:`vineyard.ObjectId` or :class:`vineyard.ObjectName`
oid_type: (str, optional): Type of vertex original id. Defaults to "int64".
directed: (bool, optional): Directed graph or not. Defaults to True.
generate_eid: (bool, optional): Generate id for each edge when setted True. Defaults to True.
Expand Down Expand Up @@ -450,13 +452,20 @@ def add_edges(
):
"""Add edges to the graph, and return a new graph.
Here the src_label and dst_label must be both specified or both unspecified,
i. src_label and dst_label both unspecified and current graph has no vertex label.
We deduce vertex label from edge table, and set vertex label name to '_'.
ii. src_label and dst_label both unspecified and current graph has one vertex label.
We set src_label and dst label to this single vertex label.
ii. src_label and dst_label both specified and existed in current graph's vertex labels.
iii. src_label and dst_label both specified and some are not existed in current graph's vertex labels.
we deduce missing vertex labels from edge tables.
i. src_label and dst_label both unspecified and current graph has no vertex label.
We deduce vertex label from edge table, and set vertex label name to '_'.
ii. src_label and dst_label both unspecified and current graph has one vertex label.
We set src_label and dst label to this single vertex label.
ii. src_label and dst_label both specified and existed in current graph's vertex labels.
iii. src_label and dst_label both specified and some are not existed in current graph's vertex labels.
We deduce missing vertex labels from edge tables.
Args:
Expand Down
2 changes: 1 addition & 1 deletion python/graphscope/learning/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def V(self, t, feed=None):
Args:
t (string): The type of node which is the entry of query or the type
of edge when node is from edge source or dst.
of edge when node is from edge source or dst.
feed (None| numpy.ndarray | types.GeneratorType | `Nodes`): When `feed`
is not `None`, the `type` should be a node type, which means query the
attributes of the specified node ids.
Expand Down
4 changes: 2 additions & 2 deletions python/graphscope/nx/classes/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def set_edge_data(self, u, v, data):
-----
the method is called when to set_items in AdjEdgeAttr
Examples:
Examples
--------
>>> G = nx.Graph() # or DiGraph
>>> G.add_edge(1, 2)
Expand Down Expand Up @@ -1082,7 +1082,7 @@ def set_node_data(self, n, data):
-----
the method is called when to set_items in NodeAttr
Examples:
Examples
--------
>>> G = nx.Graph() # or DiGraph
>>> G.add_node(1)
Expand Down
Loading

0 comments on commit 6d5d288

Please sign in to comment.