当前位置:网站首页>Example explanation: move graph explorer to jupyterlab
Example explanation: move graph explorer to jupyterlab
2022-07-01 18:53:00 【InfoQ】

One 、 Prepare before use
1. Huawei cloud account
2. OBS Object storage service
3. GES Figure Engine Services
4. Get call GES Business API Required parameters
Two 、 Use GES4Jupyter Connect GES service

import moxing as mox
mox.file.copy('obs://obs-aigallery-zc/GES/ges4jupyter/beta/ges4jupyter.py', 'ges4jupyter.py')
mox.file.copy('obs://obs-aigallery-zc/GES/ges4jupyter/beta/ges4jupyter.html', 'ges4jupyter.html')
from ges4jupyter import GESConfig, GES4Jupyter, read_csv_config
eip = ''
project_id = ''
graph_name = ''
iam_url = ''
user_name = ''
password = ''
domain_name = ''
project_name = ''
port = 80
eip, project_id, graph_name, iam_url, user_name, password, domain_name, project_name, port = read_csv_config('cn_north_4_graph.csv')
config = GESConfig(eip, project_id, graph_name,
iam_url = iam_url,
user_name = user_name,
password = password,
domain_name = domain_name,
project_name = project_name,
port = port)
ges_util = GES4Jupyter(config, True);- Is used to construct API Parameters of :eip,projectId,graph_name, port These four parameters are involved in the construction of the business face request url.eip And graph_name The two parameters are easy to obtain in drawing creation ,port The parameter defaults to 80, When safe mode is turned on, it is 443, About projectId, Refer to the official website of the graph engine - Get the project id, Get items from the graph console according to the region to which the graph belongs id.
- Used when requesting API Pre acquisition token Parameters of :iam_url, user_name, password, domain_name,project_name,GES4Jupyter These four parameters will be used to get token, And then in use api To authenticate , For relevant parameters, please refer to : Huawei graphics engine documentation - Business API Authentication and call GES Service business API Acquisition of relevant parameters

print(' Start creating point index :')
job_id = ges_util.build_vertex_index()
job_result = ges_util.get_job(job_id)
if 'errorCode' not in job_result:
for i in range(100):
if job_result['status'] == 'success':
break
else:
time.sleep(1)
job_result = ges_util.get_job(job_id)
print(' Point index creation completed ')
print(' Start creating edge index :')
job_id = ges_util.build_edge_index()
job_result = ges_util.get_job(job_id)
if 'errorCode' not in job_result:
for i in range(100):
if job_result['status'] == 'success':
break
else:
time.sleep(1)
job_result = ges_util.get_job(job_id)
print(' Edge index creation completed ')ges_util.cypher_query("call dbms.parameter('needNodeIndex', false)");
ges_util.cypher_query("call dbms.parameter('needEdgeIndex', false)");
3、 ... and 、 Use GES4Jupyter Call the business interface and visualize it
cypher_result = ges_util.cypher_query("match (n)-[r]->(m) return n,r,m limit 10",formats=['row','graph']);
ges_util.format_cypher_result(cypher_result)

gremlin_result = ges_util.gremlin_query("g.V().outE().bothV().path().limit(2)");
ges_util.format_gremlin_result(gremlin_result)
result = ges_util.path_query({
"repeat": [
{
"operator": "bothV",
"vertex_filter": {
"property_filter": {
"leftvalue": {
"id": ""
},
"predicate": "NOTIN",
"rightvalue": {
"value": [" Beijing "]
}
}
}
}
],
"until": [
{
"vertex_filter": {
"property_filter": {
"leftvalue": {
"id": ""
},
"predicate": "=",
"rightvalue": {
"value": [" mesozoic-cenozoic "]
}
}
}
}
],
"times": 5,
"queryType": "Tree",
"vertices": [" Beijing case 2"]
})
ges_util.format_path_query(result)
Four 、 There are more cases available on the official website of the graph engine GES4Jupyter Hands on experience

边栏推荐
- 太爱速M源码搭建,巅峰小店APP溢价寄卖源码分享
- Find all missing numbers in the array
- 数据库基础:select基本查询语句
- Li Kou daily question - Day 32 -589 N × Preorder traversal of tree
- 3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
- Facebook聊单,SaleSmartly有妙招!
- 华为云专家详解GaussDB(for MySQL)新特性
- Popular science: what does it mean to enter the kernel state?
- LiveData postValue会“丢”数据
- Must see, time series analysis
猜你喜欢

Memo - about C # generating barcode

How to find customers for investment attraction in industrial parks

Why do independent website sellers start to do social media marketing? The original customer conversion rate can be improved so much!

实例讲解将Graph Explorer搬上JupyterLab

After studying 11 kinds of real-time chat software, I found that they all have these functions

AI training speed breaks Moore's law; Song shuran's team won the RSS 2022 Best Paper Award

磁盘的基本知识和基本命令

用WPF写一款开源方便、快捷的数据库文档查询、生成工具

Altair HyperWorks 2022软件安装包和安装教程

540. Single element in ordered array / 1684 Count the number of consistent strings
随机推荐
AppGallery Connect场景化开发实战—图片存储分享
R language uses the aggregate function of epidisplay package to divide numerical variables into different subsets based on factor variables, and calculate the summary statistics of each subset
Mise en place d'une plate - forme générale de surveillance et d'alarme, quelles sont les conceptions nécessaires dans l'architecture?
隐私沙盒终于要来了
OpenAI|视频预训练 (VPT):基于观看未标记的在线视频的行动学习
ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
太爱速M源码搭建,巅峰小店APP溢价寄卖源码分享
每周推薦短視頻:警惕“現象”與“問題”相互混淆
Memo - about C # generating barcode for goods
1380. Lucky number in matrix / 1672 Total assets of the richest customers
Leetcode-141 circular linked list
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
Lumiprobe biomolecular quantification - qudye Protein Quantification Kit
C# SelfHost WebAPI (2)
bean的生命周期核心步骤总结
After studying 11 kinds of real-time chat software, I found that they all have these functions
Case study on comprehensive competitiveness of principal components
数据仓库(四)之ETL开发
数据库基础:select基本查询语句
Must see, time series analysis