【问题标题】:Different image for nodes in Neptune Jupyter notebookNeptune Jupyter notebook 中节点的不同图像
【发布时间】:2021-12-24 16:50:04
【问题描述】:

我已成功将 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

【问题讨论】:

  • 您看过 02-visualization 文件夹中的示例了吗?空中航线 Gremlin 示例展示了如何为节点使用自定义图标。
  • 我继续在下面添加了一个答案。您还可以在位于此处的项目的 Git 存储库中找到更多信息:github.com/aws/graph-notebook

标签: amazon-web-services gremlin graph-databases amazon-neptune graph-notebook


【解决方案1】:

这是一个来自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 日编辑

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

【讨论】:

    猜你喜欢
    • 2022-08-09
    • 2020-07-03
    • 2022-06-22
    • 1970-01-01
    • 1970-01-01
    • 2020-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多