{"id":18725150,"url":"https://github.com/vesoft-inc/nebula-algorithm","last_synced_at":"2025-04-10T16:13:27.357Z","repository":{"id":38405106,"uuid":"409808748","full_name":"vesoft-inc/nebula-algorithm","owner":"vesoft-inc","description":"Nebula-Algorithm is a Spark Application based on GraphX, which enables state of art Graph Algorithms to run on top of NebulaGraph and write back results to NebulaGraph.","archived":false,"fork":false,"pushed_at":"2024-08-19T05:35:05.000Z","size":71089,"stargazers_count":75,"open_issues_count":7,"forks_count":40,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-24T14:04:48.953Z","etag":null,"topics":["graph-algorithm","graph-database","graphx","hacktoberfest","nebulagraph","spark"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vesoft-inc.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/Apache-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-24T02:38:50.000Z","updated_at":"2025-03-14T10:05:39.000Z","dependencies_parsed_at":"2024-02-23T11:25:20.036Z","dependency_job_id":"269d6637-48d4-4f54-847b-dd81dc6a60b7","html_url":"https://github.com/vesoft-inc/nebula-algorithm","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vesoft-inc","download_url":"https://codeload.github.com/vesoft-inc/nebula-algorithm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248251482,"owners_count":21072689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-algorithm","graph-database","graphx","hacktoberfest","nebulagraph","spark"],"created_at":"2024-11-07T14:09:16.010Z","updated_at":"2025-04-10T16:13:27.341Z","avatar_url":"https://github.com/vesoft-inc.png","language":"Scala","readme":"# 欢迎使用 Nebula Algorithm\n\nnebula-algorithm 是一款基于 [GraphX](https://spark.apache.org/graphx/) 的 Spark 应用程序，提供了以下图计算算法：\n\n\n |           算法名          |中文说明|应用场景|\n |:------------------------:|:-----------:|:----:|\n |         PageRank         |  页面排序  | 网页排序、重点节点挖掘|\n |         Louvain          |  社区发现  | 社团挖掘、层次化聚类|\n |          KCore           |    K核    |社区发现、金融风控|\n |     LabelPropagation     |  标签传播  |资讯传播、广告推荐、社区发现|\n |          Hanp            |  标签传播进阶版|社区发现、推荐|\n |    ConnectedComponent    |  联通分量  |社区发现、孤岛发现|\n |StronglyConnectedComponent| 强联通分量  |社区发现|\n |       ShortestPath       |  最短路径   |路径规划、网络规划|\n |       TriangleCount      | 三角形计数  |网络结构分析|\n |     GraphTriangleCount   |全图三角形计数|网络紧密性分析|\n |   BetweennessCentrality  | 介数中心性  |关键节点挖掘、节点影响力计算|\n |        Closeness         | 接近中心性  |关键节点挖掘、节点影响力计算|\n |        DegreeStatic      |   度统计   |图结构分析|\n |   ClusteringCoefficient  |  聚集系数  |推荐、电信诈骗分析|\n |         Jaccard          |杰卡德相似度计算|相似度计算、推荐|\n |          BFS             |广度优先遍历 |层序遍历、最短路径规划|\n |          DFS             |深度优先遍历 |层序遍历、最短路径规划|\n |         Node2Vec         |    -      |图分类|\n \n使用 `nebula-algorithm`，可以通过提交 `Spark` 任务的形式使用完整的算法工具对 `Nebula Graph` 数据库中的数据执行图计算，也可以通过编程形式调用`lib`库下的算法针对DataFrame执行图计算。\n\n## 如何获取\n 1. 编译打包 Nebula Algorithm\n    ```\n    $ git clone https://github.com/vesoft-inc/nebula-algorithm.git\n    $ cd nebula-algorithm\n    $ mvn clean package -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.test.skip=true\n    ```\n    编译完成后，在 `nebula-algorithm/target` 目录下会生成 `nebula-algorithm-3.0-SNAPSHOT.jar` 。\n\n 2. 在 Maven 远程仓库下载\n   https://repo1.maven.org/maven2/com/vesoft/nebula-algorithm/\n\n# 使用 Nebula Algorithm\n   \n* 使用方法1：直接提交 nebula-algorithm 算法包\n\n   * 设置配置文件\n   \n    关于配置项的具体说明参考[示例配置](https://github.com/vesoft-inc/nebula-algorithm/blob/master/nebula-algorithm/src/main/resources/application.conf)\n\n   * 提交算法任务\n\n    ```\n    ${SPARK_HOME}/bin/spark-submit --master \u003cmode\u003e --class com.vesoft.nebula.algorithm.Main nebula-algorithm-3.0-SNAPSHOT.jar -p application.conf\n    ```\n* 使用方法2：调用 nebula-algorithm 算法接口\n\n   在 `nebula-algorithm` 的 `lib` 库中提供了10+种常用图计算算法，可通过编程调用的形式调用算法。\n   * 在pom.xml中添加依赖\n   ```\n    \u003cdependency\u003e\n         \u003cgroupId\u003ecom.vesoft\u003c/groupId\u003e\n         \u003cartifactId\u003enebula-algorithm\u003c/artifactId\u003e\n         \u003cversion\u003e3.0.0\u003c/version\u003e\n    \u003c/dependency\u003e\n   ```\n   * 定义算法参数调用算法（以`PageRank`为例）\n   ```\n   import com.vesoft.nebula.algorithm.config.{Configs, PRConfig, SparkConfig}\n   import org.apache.spark.sql.{DataFrame, SparkSession}\n\n   val spark = SparkSession.builder().master(\"local\").getOrCreate()\n   val data  = spark.read.option(\"header\", true).csv(\"src/test/resources/edge.csv\")\n   val prConfig = new PRConfig(5, 1.0)\n   val prResult = PageRankAlgo.apply(spark, data, prConfig, false)\n   ```\n   * 如果你的节点 id 是 String 类型，可以参考 [examples](https://github.com/vesoft-inc/nebula-algorithm/tree/master/example/src/main/scala/com/vesoft/nebula/algorithm/DegreeStaticExample.scala).\n                                    \n   该 Example 进行了 id 转换，将 String 类型 id 编码为 Long 类型的 id ， 并在算法结果中将 Long 类型 id 解码为原始的 String 类型 id 。\n   \n    其他算法的调用方法见[测试示例](https://github.com/vesoft-inc/nebula-algorithm/tree/master/nebula-algorithm/src/test/scala/com/vesoft/nebula/algorithm/lib) 。\n    \n    \u003e 注：执行算法的 DataFrame 默认第一列是源点，第二列是目标点，第三列是边权重。\n\n## 运算结果写回 NebulaGraph\n\n如果你想将算法结果写入到 NebulaGraph，请确保 NebulaGraph 的 tag 中有对应算法结果名称的属性。各项算法对应的属性名如下所示：\n\n|        Algorithm         |     property name       |property type|\n|:------------------------:|:-----------------------:|:-----------:|\n|         pagerank         |         pagerank        |double/string|\n|          louvain         |          louvain        | int/string  |\n|          kcore           |           kcore         | int/string  |\n|     labelpropagation     |           lpa           | int/string  |\n|   connectedcomponent     |            cc           | int/string  |\n|stronglyconnectedcomponent|            scc          | int/string  |\n|         betweenness      |         betweenness     |double/string|\n|        shortestpath      |        shortestpath     |   string    |\n|        degreestatic      |degree,inDegree,outDegree| int/string  |\n|        trianglecount     |       trianglecount     | int/string  |\n|  clusteringcoefficient   |    clustercoefficient   |double/string|\n|         closeness        |         closeness       |double/string|\n|            hanp          |            hanp         | int/string  |\n|            bfs           |            bfs          |    string   |\n|            dfs           |            dfs          |    string   |\n|         jaccard          |          jaccard        |    string   |\n|        node2vec          |          node2vec       |    string   |\n\n## 版本兼容矩阵\n\n| Nebula Algorithm Version | Nebula Version |\n|:------------------------:|:--------------:|\n|       2.0.0              |  2.0.0, 2.0.1  |\n|       2.1.0              |  2.0.0, 2.0.1  |\n|       2.5.0              |  2.5.0, 2.5.1  |\n|       2.6.0              |  2.6.0, 2.6.1  |\n|       2.6.1              |  2.6.0, 2.6.1  |\n|       2.6.2              |  2.6.0, 2.6.1  |\n|       3.0.0              |3.0.x, 3.1.x, 3,2.x, 3.3.x|\n|     3.0-SNAPSHOT         |     nightly    |\n\n## 贡献\n\nNebula Algorithm 是一个完全开源的项目，欢迎开源爱好者通过以下方式参与：\n\n- 前往 [Nebula Graph 论坛](https://discuss.nebula-graph.com.cn/ \"点击前往“Nebula Graph 论坛\") 上参与 Issue 讨论，如答疑、提供想法或者报告无法解决的问题\n- 撰写或改进文档\n- 提交优化代码\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvesoft-inc%2Fnebula-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvesoft-inc%2Fnebula-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvesoft-inc%2Fnebula-algorithm/lists"}