Neptune Jupyter 笔记本中节点的不同图像

问题描述 投票:0回答:2

我已成功将我的node.csv和edge.csv加载到AWS Neptune。
我试图根据相应的标签将顶点显示为图像。
例如,198.51.100.0 和 adesai 之间有一条边,198.51.100.0 也连接到 gramirez。
因此,我想显示 IPAddress 的 address.png 和 adesai & gramirez 的 person.png。

我正在使用 Gremlin 语言,我已在下面尝试过,但它不起作用。

 %%graph_notebook_vis_options<br>
{<br>
  "nodes":{  "id":"0",   "label": "User", "shape": "circularImage", "image": "person.png"},<br>
  "nodes":{  "id":"1",   "label": "User","shape": "circularImage", "image": "person.png"},<br>
  "nodes":{  "id":"2",   "label": "Restaurant","shape": "circularImage", "image": "restaurant.png"},<br>
  "nodes":{  "id":"3",   "label": "Restaurant","shape": "circularImage", "image": "restaurant.png"},<br>
  "nodes":{  "id":"4",   "label": "IPAddress","shape": "circularImage", "image": "address.png"}<br>
}

节点仅显示相同的图像。 有人可以建议吗?谢谢你

Showing the node and the graph

amazon-web-services gremlin graph-databases amazon-neptune graph-notebook
2个回答
0
投票

这是取自

Air-Routes-Gremlin
示例笔记本的示例,安装笔记本后,可以在
Neptune/02-Visualization
文件夹中找到该示例。需要注意的关键是它需要作为组定义的一部分来完成。任何与给定组匹配的内容都将使用指定的图像或图标进行绘制。您还可以在位于此处的项目的 Git 存储库中找到更多信息:https://github.com/aws/graph-notebook

更改组颜色和添加图标

还提供的功能之一是能够更改颜色、添加图像或关联组的特定图标表示。运行下面的两个单元格,您将看到墨西哥的所有机场都显示有墨西哥国旗,美国的所有机场都显示为蓝色国旗,加拿大的所有机场都显示为红色。

%%graph_notebook_vis_options
{
  "groups": {
      "['CA']": {"color": "red"},
    "['MX']": {"shape": "image", 
               "image":"https://cdn.countryflags.com/thumbs/mexico/flag-round-250.png"},
    
    "['US']": {
      "shape": "icon",
      "icon": {
        "face": "FontAwesome",
        "code": "\uf024",
        "color": "blue"
      }
  }
}
}

于2021年11月16日编辑

今天不可能的是按多个键进行分组并让多个图标代表单个顶点


0
投票

Air-Routes-Gremlin 中给出的示例适用于组,但我想要每个节点的特定图像,但它不起作用。从这些条目开始:

g
.addV("System").property(id,"1").property("name","MyNode1)").as("Node1")
.addV("System").property(id,"2").property("name","MyNode2").as("Node2")
.addE("DATA_EXCHANGE").from("Node1").to("Node2")

我修改了与 Air-Routes-Gremlin 示例类似的 vis-options,但将“groups”替换为“nodes”:

%%graph_notebook_vis_options

{
  "nodes": {
    "['Node1']": {"shape": "image",
                  "image":"https://cdn.countryflags.com/thumbs/mexico/flag-round-250.png"
    }
  }
}

结果不显示 Node1 的图像。 Node1 继续使用默认节点视觉设置显示。

© www.soinside.com 2019 - 2024. All rights reserved.