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

whitespace for the rest #1257

Merged
merged 1 commit into from
Nov 24, 2021
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
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@
- 在 GitHub 提交 [issue][_issues]。
- [Fork](https://github.com/vesoft-inc/nebula-docs-cn/fork) 文档,在本地分支上更改或添加新内容,然后向主分支提交 PR。


[_issues]: https://github.com/vesoft-inc/nebula-docs-cn/issues
9 changes: 4 additions & 5 deletions docs-2.0/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 欢迎阅读Nebula Graph {{ nebula.release }} 文档
# 欢迎阅读 Nebula Graph {{ nebula.release }} 文档

!!! Note "确认正在阅读最新的版本"

Expand All @@ -8,7 +8,7 @@
本文档更新时间{{ now().year }}-{{ now().month }}-{{ now().day }}, [GitHub commit](https://github.com/vesoft-inc/nebula-docs/commits/v{{nebula.release}}) {{ git.short_commit }}。
-->

Nebula Graph是一款开源的、分布式的、易扩展的原生图数据库,能够承载数千亿个点和数万亿条边的超大规模数据集,并且提供毫秒级查询。
Nebula Graph 是一款开源的、分布式的、易扩展的原生图数据库,能够承载数千亿个点和数万亿条边的超大规模数据集,并且提供毫秒级查询。

## 快速开始

Expand All @@ -30,7 +30,6 @@ Graph 完全指南》](https://docs.nebula-graph.com.cn/site/pdf/NebulaGraph-boo

## 图例说明


<!--
本文有 40+ 个 caution。
本文有 30+ 个 danger。
Expand All @@ -47,7 +46,7 @@ Graph 完全指南》](https://docs.nebula-graph.com.cn/site/pdf/NebulaGraph-boo

!!! danger

会引发危险的事项。不遵守danger必定会导致系统故障、数据丢失、安全问题等。
会引发危险的事项。不遵守 danger 必定会导致系统故障、数据丢失、安全问题等。

!!! performance

Expand All @@ -59,7 +58,7 @@ Graph 完全指南》](https://docs.nebula-graph.com.cn/site/pdf/NebulaGraph-boo

!!! compatibility

nGQL与openCypher的兼容性或nGQL当前版本与历史版本的兼容性
nGQL 与 openCypher 的兼容性或 nGQL 当前版本与历史版本的兼容性

!!! enterpriseonly

Expand Down
115 changes: 56 additions & 59 deletions docs-2.0/nebula-algorithm.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Nebula Algorithm

[Nebula Algorithm](https://github.com/vesoft-inc/nebula-algorithm) (简称Algorithm)是一款基于[GraphX](https://spark.apache.org/graphx/)的Spark应用程序,通过提交Spark任务的形式使用完整的算法工具对Nebula Graph数据库中的数据执行图计算,也可以通过编程形式调用lib库下的算法针对DataFrame执行图计算
[Nebula Algorithm](https://github.com/vesoft-inc/nebula-algorithm) (简称 Algorithm)是一款基于 [GraphX](https://spark.apache.org/graphx/) 的 Spark 应用程序,通过提交 Spark 任务的形式使用完整的算法工具对 Nebula Graph 数据库中的数据执行图计算,也可以通过编程形式调用 lib 库下的算法针对 DataFrame 执行图计算

## 前提条件

在使用 Algorithm 之前,用户需要确认以下信息:

- Nebula Graph 服务已经部署并启动。详细信息,参考[Nebula Graph安装部署](4.deployment-and-installation/1.resource-preparations.md "点击前往 Nebula Graph 安装部署")。
- Nebula Graph 服务已经部署并启动。详细信息,参考 [Nebula Graph 安装部署](4.deployment-and-installation/1.resource-preparations.md "点击前往 Nebula Graph 安装部署")。

- Spark 版本为 2.4.x。

- Scala 版本为 2.11。

- (可选)如果用户需要在Github中克隆最新的Algorithm,并自行编译打包,可以选择安装[Maven](https://maven.apache.org/download.cgi)。
- (可选)如果用户需要在 Github 中克隆最新的 Algorithm,并自行编译打包,可以选择安装 [Maven](https://maven.apache.org/download.cgi)。

## 使用限制

点ID的数据必须为整数,即点ID可以是INT类型,或者是String类型但数据本身为整数
点 ID 的数据必须为整数,即点 ID 可以是 INT 类型,或者是 String 类型但数据本身为整数

对于非整数的String类型数据,推荐使用调用算法接口的方式,可以使用SparkSQL的`dense_rank`函数进行编码,将String类型转换为Long类型
对于非整数的 String 类型数据,推荐使用调用算法接口的方式,可以使用 SparkSQL 的`dense_rank`函数进行编码,将 String 类型转换为 Long 类型

## 支持算法

Nebula Algorithm支持的图计算算法如下
Nebula Algorithm 支持的图计算算法如下

| 算法名 |说明|应用场景|
|:------------------------|:-----------|:----|
| PageRank | 页面排序 | 网页排序、重点节点挖掘|
| Louvain | 社区发现 | 社团挖掘、层次化聚类|
| KCore | K核 |社区发现、金融风控|
| KCore | K 核 |社区发现、金融风控|
| LabelPropagation | 标签传播 |资讯传播、广告推荐、社区发现|
| ConnectedComponent | 联通分量 |社区发现、孤岛发现|
|StronglyConnectedComponent| 强联通分量 |社区发现|
Expand All @@ -40,17 +40,17 @@ Nebula Algorithm支持的图计算算法如下。

## 实现方法

Nebula Algorithm实现图计算的流程如下
Nebula Algorithm 实现图计算的流程如下

1. 利用Nebula Spark Connector从Nebula Graph数据库中读取图数据为DataFrame
1. 利用 Nebula Spark Connector 从 Nebula Graph 数据库中读取图数据为 DataFrame

2. 将DataFrame转换为GraphX的图
2. 将 DataFrame 转换为 GraphX 的图

3. 调用GraphX提供的图算法(例如PageRank)或者自行实现的算法(例如Louvain社区发现)。
3. 调用 GraphX 提供的图算法(例如 PageRank)或者自行实现的算法(例如 Louvain 社区发现)。

详细的实现方法可以参见相关[Scala文件](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib)。
详细的实现方法可以参见相关 [Scala 文件](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib)。

## 获取Nebula Algorithm
## 获取 Nebula Algorithm

### 编译打包

Expand All @@ -74,15 +74,15 @@ Nebula Algorithm实现图计算的流程如下:

编译完成后,在目录`nebula-algorithm/target`下生成类似文件`nebula-algorithm-{{algorithm.release}}.jar`。

### Maven远程仓库下载
### Maven 远程仓库下载

[下载地址](https://repo1.maven.org/maven2/com/vesoft/nebula-algorithm/{{algorithm.release}}/)

## 使用方法

### 调用算法接口(推荐)

`lib`库中提供了10种常用图计算算法,用户可以通过编程调用的形式调用算法。
`lib`库中提供了 10 种常用图计算算法,用户可以通过编程调用的形式调用算法。

1. 在文件`pom.xml`中添加依赖。

Expand All @@ -94,11 +94,11 @@ Nebula Algorithm实现图计算的流程如下:
</dependency>
```

2. 传入参数调用算法(以PageRank为例)。更多算法请参见[测试用例](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib)。
2. 传入参数调用算法(以 PageRank 为例)。更多算法请参见 [测试用例](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib)。

!!! note

执行算法的DataFrame默认第一列是起始点,第二列是目的点,第三列是边权重(非Nebula Graph中的Rank)。
执行算法的 DataFrame 默认第一列是起始点,第二列是目的点,第三列是边权重(非 Nebula Graph 中的 Rank)。

```bash
val prConfig = new PRConfig(5, 1.0)
Expand All @@ -108,63 +108,63 @@ Nebula Algorithm实现图计算的流程如下:
### 直接提交算法包

!!! note
使用封装好的算法包有一定的局限性,例如落库到Nebula Graph时,落库的图空间中创建的Tag的属性名称必须和代码内预设的名称保持一致。如果用户有开发能力,推荐使用第一种方法。
使用封装好的算法包有一定的局限性,例如落库到 Nebula Graph 时,落库的图空间中创建的 Tag 的属性名称必须和代码内预设的名称保持一致。如果用户有开发能力,推荐使用第一种方法。

1. 设置[配置文件](https://github.com/vesoft-inc/nebula-algorithm/blob/{{algorithm.branch}}/nebula-algorithm/src/main/resources/application.conf)。
1. 设置 [配置文件](https://github.com/vesoft-inc/nebula-algorithm/blob/{{algorithm.branch}}/nebula-algorithm/src/main/resources/application.conf)。

```bash
{
# Spark相关配置
# Spark 相关配置
spark: {
app: {
name: LPA
# Spark分片数量
# Spark 分片数量
partitionNum:100
}
master:local
}

data: {
# 数据源,可选值为nebula、csv、json。
# 数据源,可选值为 nebula、csv、json。
source: nebula
# 数据落库,即图计算的结果写入的目标,可选值为nebula、csv、json。
# 数据落库,即图计算的结果写入的目标,可选值为 nebula、csv、json。
sink: nebula
# 算法是否需要权重。
hasWeight: false
}

# Nebula Graph相关配置
# Nebula Graph 相关配置
nebula: {
# 数据源。Nebula Graph作为图计算的数据源时,nebula.read的配置才生效
# 数据源。Nebula Graph 作为图计算的数据源时,nebula.read 的配置才生效
read: {
# 所有Meta服务的IP地址和端口,多个地址用英文逗号(,)分隔。格式: "ip1:port1,ip2:port2"。
# 使用docker-compose部署,端口需要填写docker-compose映射到外部的端口
# 所有 Meta 服务的 IP 地址和端口,多个地址用英文逗号(,)分隔。格式"ip1:port1,ip2:port2"。
# 使用 docker-compose 部署,端口需要填写 docker-compose 映射到外部的端口
# 可以用`docker-compose ps`查看
metaAddress: "192.168.*.10:9559"
# Nebula Graph图空间名称
# Nebula Graph 图空间名称
space: basketballplayer
# Nebula Graph Edge type, 多个labels时,多个边的数据将合并。
# Nebula Graph Edge type, 多个 labels 时,多个边的数据将合并。
labels: ["serve"]
# Nebula Graph每个Edge type的属性名称,此属性将作为算法的权重列,请确保和Edge type对应
# Nebula Graph 每个 Edge type 的属性名称,此属性将作为算法的权重列,请确保和 Edge type 对应
weightCols: ["start_year"]
}

# 数据落库。图计算结果落库到Nebula Graph时,nebula.write的配置才生效
# 数据落库。图计算结果落库到 Nebula Graph 时,nebula.write 的配置才生效
write:{
# Graph服务的IP地址和端口, 多个地址用英文逗号(,)分隔。格式: "ip1:port1,ip2:port2"。
# 使用docker-compose部署,端口需要填写docker-compose映射到外部的端口
# Graph 服务的 IP 地址和端口,多个地址用英文逗号(,)分隔。格式"ip1:port1,ip2:port2"。
# 使用 docker-compose 部署,端口需要填写 docker-compose 映射到外部的端口
# 可以用`docker-compose ps`查看
graphAddress: "192.168.*.11:9669"
# 所有Meta服务的IP地址和端口,多个地址用英文逗号(,)分隔。格式: "ip1:port1,ip2:port2"。
# 使用docker-compose部署,端口需要填写docker-compose映射到外部的端口
# 所有 Meta 服务的 IP 地址和端口,多个地址用英文逗号(,)分隔。格式"ip1:port1,ip2:port2"。
# 使用 docker-compose 部署,端口需要填写 docker-compose 映射到外部的端口
# 可以用`docker-compose ps`查看
metaAddress: "192.168.*.12:9559"
user:root
pswd:nebula
# 在提交图计算任务之前需要自行创建图空间及Tag
# Nebula Graph图空间名称
# 在提交图计算任务之前需要自行创建图空间及 Tag
# Nebula Graph 图空间名称
space:nb
# Nebula Graph Tag名称,图计算结果会写入该Tag。Tag中的属性名称固定如下
# Nebula Graph Tag 名称,图计算结果会写入该 Tag。Tag 中的属性名称固定如下
# PageRank:pagerank
# Louvain:louvain
# ConnectedComponent:cc
Expand All @@ -180,82 +180,79 @@ Nebula Algorithm实现图计算的流程如下:
}

local: {
# 数据源。图计算的数据源为csv文件或json文件时,local.read的配置才生效
# 数据源。图计算的数据源为 csv 文件或 json 文件时,local.read 的配置才生效
read:{
filePath: "hdfs://127.0.0.1:9000/edge/work_for.csv"
# 如果CSV文件没有表头,使用[_c0, _c1, _c2, ..., _cn]表示其表头,有表头或者是json文件时,直接使用表头名称即可。
# 起始点ID列的表头
# 如果 CSV 文件没有表头,使用 [_c0, _c1, _c2, ..., _cn] 表示其表头,有表头或者是 json 文件时,直接使用表头名称即可。
# 起始点 ID 列的表头
srcId:"_c0"
# 目的点ID列的表头
# 目的点 ID 列的表头
dstId:"_c1"
# 权重列的表头
weight: "_c2"
# csv文件是否有表头
# csv 文件是否有表头
header: false
# csv文件的分隔符
# csv 文件的分隔符
delimiter:","
}

# 数据落库。图计算结果落库到csv文件或text文件时,local.write的配置才生效
# 数据落库。图计算结果落库到 csv 文件或 text 文件时,local.write 的配置才生效
write:{
resultPath:/tmp/
}
}


algorithm: {
# 需要执行的算法,可选值为:pagerank、louvain、connectedcomponent、
# labelpropagation、shortestpaths、degreestatic、kcore、
# stronglyconnectedcomponent、trianglecount、betweenness
executeAlgo: pagerank

# PageRank参数
# PageRank 参数
pagerank: {
maxIter: 10
resetProb: 0.15 # 默认为0.15
resetProb: 0.15 # 默认为 0.15
}

# Louvain参数
# Louvain 参数
louvain: {
maxIter: 20
internalIter: 10
tol: 0.5
}

# ConnectedComponent/StronglyConnectedComponent参数
# ConnectedComponent/StronglyConnectedComponent 参数
connectedcomponent: {
maxIter: 20
}

# LabelPropagation参数
# LabelPropagation 参数
labelpropagation: {
maxIter: 20
}

# ShortestPath参数
# ShortestPath 参数
shortestpaths: {
# several vertices to compute the shortest path to all vertices.
landmarks: "1"
}

# DegreeStatic参数
# DegreeStatic 参数
degreestatic: {}

# KCore参数
# KCore 参数
kcore:{
maxIter:10
degree:1
}

# TriangleCount参数
# TriangleCount 参数
trianglecount:{}

# BetweennessCentrality参数
# BetweennessCentrality 参数
betweenness:{
maxIter:5
}
}
}
```

2. 提交图计算任务。
Expand All @@ -272,5 +269,5 @@ Nebula Algorithm实现图计算的流程如下:

## 视频

* [图计算工具——Nebula Algorithm 介绍](https://www.bilibili.com/video/BV1fB4y1T7XK)(2分36秒
* [图计算工具——Nebula Algorithm 介绍](https://www.bilibili.com/video/BV1fB4y1T7XK)(2 分 36 秒
<iframe src="//player.bilibili.com/player.html?aid=588577467&bvid=BV1fB4y1T7XK&cid=351282857&page=1&high_quality=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="720px" height="480px"> </iframe>
15 changes: 7 additions & 8 deletions docs-2.0/nebula-bench.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# Nebula Bench

Nebula Bench是一款利用LDBC数据集对Nebula Graph进行性能测试的工具
Nebula Bench 是一款利用 LDBC 数据集对 Nebula Graph 进行性能测试的工具

## 适用场景

- 生成测试数据并导入Nebula Graph。
- 生成测试数据并导入 Nebula Graph。

- 对Nebula Graph集群进行性能测试
- 对 Nebula Graph 集群进行性能测试

## 更新说明

[Release](https://github.com/vesoft-inc/nebula-bench/releases/tag/{{bench.tag}})

## 测试流程

1. 使用ldbc_snb_datagen生成测试数据
1. 使用 ldbc_snb_datagen 生成测试数据

2. 使用importer导入数据到Nebula Graph。
2. 使用 importer 导入数据到 Nebula Graph。

3. 使用K6(含xk6-nebula插件)进行性能测试。

详细使用说明请参见[Nebula Bench](https://github.com/vesoft-inc/nebula-bench/blob/{{bench.branch}}/README_cn.md)。
3. 使用 K6(含 xk6-nebula 插件)进行性能测试。

详细使用说明请参见 [Nebula Bench](https://github.com/vesoft-inc/nebula-bench/blob/{{bench.branch}}/README_cn.md)。
Loading