简体   繁体   English

Neptune Jupyter notebook 中节点的不同图像

[英]Different image for nodes in Neptune Jupyter notebook

I loaded my node.csv and edge.csv successfully to AWS Neptune.我已成功将 node.csv 和 edge.csv 加载到 AWS Neptune。
I'm trying to display the vertices as an image accordingly to the corresponding label.我试图根据相应的标签将顶点显示为图像。
For example, there's an edge between 198.51.100.0 & adesai and 198.51.100.0 is also connecting to gramirez.例如,在 198.51.100.0 & adesai 和 198.51.100.0 之间有一条边也连接到 gramirez。
So, I would like to display a address.png for the IPAddress and a person.png for adesai & gramirez.所以,我想为 IPAddress 显示一个 address.png,为 adesai & gramirez 显示一个 person.png。

I'm using Gremlin lanugage and I have tried below but it's not working.我正在使用 Gremlin lanugage 并且我在下面尝试过,但它不起作用。

 %%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>
}

The nodes are just showing the same image.节点只是显示相同的图像。 Can anyone advise?任何人都可以建议吗? thank you谢谢你

Showing the node and the graph显示节点和图形

Here is an example taken from the Air-Routes-Gremlin sample notebook, that once the notebooks are installed, can be found in the Neptune/02-Visualization folder.这是从Air-Routes-Gremlin示例笔记本中获取的示例,一旦安装了笔记本,就可以在Neptune/02-Visualization文件夹中找到。 The key thing to note is that it needs to be done as part of a group definition.需要注意的关键是它需要作为组定义的一部分来完成。 Anything that matches the given group will be drawn using the specified image or icon.将使用指定的图像或图标绘制与给定组匹配的任何内容。 You can also find additional information in the Git repo for the project which is located here: https://github.com/aws/graph-notebook您还可以在位于此处的项目的 Git 存储库中找到其他信息: https : //github.com/aws/graph-notebook

Changing Group Colors and Adding Icons更改组颜色和添加图标

One of the features that is also available is the ability to change the color, add an image, or associate a particular icon representation for a group.还可用的功能之一是能够更改颜色、添加图像或为组关联特定图标表示。 Run the two cells below and you will see that all airports in Mexico are shown with the Mexican flag, all airports in the US are shown as a blue flag, and all airports in Canada are shown in red.运行下面的两个单元格,您将看到墨西哥的所有机场都显示有墨西哥国旗,美国的所有机场都显示为蓝旗,加拿大的所有机场都显示为红色。

%%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"
      }
  }
}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM