当前位置:网站首页>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

边栏推荐
- GameFramework食用指南
- GAMES202作业0-环境搭建过程&解决遇到的问题
- R language ggplot2 visualization: gganimate creates a dynamic histogram animation (GIF), and displays the histogram and enter step by step along a given dimension in the animation_ Growth function and
- LeetCode-21合并两个有序链表
- 如何运营好技术相关的自媒体?
- Navicat premium 15 permanent cracking and 2021 latest idea cracking (valid for personal testing)
- Regular expression
- R语言epiDisplay包ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、write.csv函数保存csv
- 信度系数低怎么办?信度系数具体怎么算?
- About enterprise middle office planning and it architecture microservice transformation
猜你喜欢

How to find customers for investment attraction in industrial parks

Create your own NFT collections and publish a Web3 application to show them (Introduction)

Principal component calculation weight

Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒

NSI packaging script add file details

Leetcode-141环形链表

力扣每日一题-第32天-589.N×树的前序遍历

解决方案:可以ping别人,但是别人不能ping我

Leetcode-21 combines two ordered linked lists

Using OpenSSL encryption to rebound shell traffic
随机推荐
How to realize the applet in its own app to realize continuous live broadcast
Lefse analysis
如何在自有APP内实现小程序实现连麦直播
研究了11种实时聊天软件,我发现都具备这些功能…
Regular expression
Navicat Premium 15 永久破解和2021版本最新IDEA破解(亲测有效)
Three. JS learning - basic operation of camera (learn from)
R language uses follow up of epidisplay package Plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses n.of The lines parameter specifies the num
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
宏观视角看抖音全生态
ES6 summary "suggestions collection" of array methods find(), findindex()
2. Create your own NFT collections and publish a Web3 application to show them start and run your local environment
洞态在某互联⽹⾦融科技企业的最佳落地实践
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!
Go语言自学系列 | go语言数据类型
Usage and underlying implementation principle of PriorityQueue
The R language uses the tablestack function of epidisplay package to make statistical summary tables (descriptive statistics based on the grouping of target variables, hypothesis testing, etc.). If th
540. Single element in ordered array / 1684 Count the number of consistent strings
Write it down once Net travel management background CPU Explosion Analysis