简体   繁体   English

ArangoDb中的Web界面上的可视化无法正常工作

[英]Visulaization on web interface in ArangoDb not working as expected

I am testing ArangoDb for using the graph features provided by the framework. 我正在测试ArangoDb使用框架提供的图形功能。

I am trying to create a very simple graph like below, similar to the Java driver example provided here, https://github.com/arangodb/arangodb-java-driver/ 我正在尝试创建一个如下所示的非常简单的图形,类似于此处提供的Java驱动程序示例:https://github.com/arangodb/arangodb-java-driver/

    List<EdgeDefinitionEntity> edgeDefinitions = new ArrayList<EdgeDefinitionEntity>();
    EdgeDefinitionEntity edgeDefinition = new EdgeDefinitionEntity();

    edgeDefinition.setCollection("myEdgeCollection");
    List<String> from = new ArrayList<String>();
    from.add("myCollection1");
    edgeDefinition.setFrom(from);

    List<String> to = new ArrayList<String>();
    to.add("myCollection2");
    edgeDefinition.setTo(to);


    edgeDefinitions.add(edgeDefinition);

    GraphEntity graph = arangoDriver.createGraph("myGraph",
            edgeDefinitions, null, true);


    User myObject1 = new User("Homer", 38);
    User myObject2 = new User("Bart", 36);

    User myObject3 = new User("Marge", 39);
    User myObject4 = new User("Lisa", 40);

    DocumentEntity<User> vertexFrom1 = arangoDriver.graphCreateVertex(
            "myGraph", "myCollection1", myObject1, true);
    DocumentEntity<User> vertexFrom2 = arangoDriver.graphCreateVertex(
            "myGraph", "myCollection1", myObject2, true);

    DocumentEntity<User> vertexTo1 = arangoDriver.graphCreateVertex(
            "myGraph", "myCollection2", myObject3, true);

    DocumentEntity<User> vertexTo2 = arangoDriver.graphCreateVertex(
            "myGraph", "myCollection2", myObject4, true);

    EdgeEntity<?> edge1 = arangoDriver.graphCreateEdge("myGraph",
            "myEdgeCollection", null, vertexFrom1.getDocumentHandle(),
            vertexTo1.getDocumentHandle(), null, null);
    EdgeEntity<?> edge2 = arangoDriver.graphCreateEdge("myGraph",
            "myEdgeCollection", null, vertexFrom2.getDocumentHandle(),
            vertexTo2.getDocumentHandle(), null, null);

The edge collection seems to have a right mapping, 边缘集合似乎具有正确的映射,

{"_from":"myCollection1/1544266710","_to":"myCollection2/1544987606"}
{"_from":"myCollection1/1544528854","_to":"myCollection2/1545249750"}

I am trying to visualise this graph in the web interface. 我正在尝试在Web界面中可视化此图。 Graph visualization is showing some weird behaviour which I do not understand. 图形可视化显示了一些我不理解的奇怪行为。 In the above setup, I expect four nodes in the graph with edges between "Homer" -- "Marge" and "Bart" -- "Lisa" but I see only two nodes and one edge, ie Homer -- Marge. 在上述设置中,我希望图中的四个节点的边在“荷马”-“ Marge”和“ Bart”-“ Lisa”之间,但我只能看到两个节点和一个边,即Homer-Marge。

Visulaization view itself sometimes shows that there are no nodes and on revisit to the same page nodes appear. 可视化视图本身有时会显示没有节点,并且在重新访问同一页面时会出现节点。

The graph viewer starts with a random vertex. 图形查看器以随机顶点开始。 That means it probably uses a totally different start vertex whenever it's opened. 这意味着只要打开它,它就可能使用完全不同的起始顶点。

This is because a graph in the general case can contain many vertices and displaying all of them together is not an option because it may take a long time to render or even crash the browser. 这是因为在通常情况下,一个图形可以包含许多顶点,并且将所有顶点显示在一起不是一个选择,因为渲染或使浏览器崩溃可能需要很长时间。 Which vertex to put into the center of the display at start is also not really easy to determine because this would require the graph viewer to know which vertex is more important than others or most important to the users. 在开始时将哪个顶点放到显示中心也不是一件容易的事,因为这将要求图形查看器知道哪个顶点比其他顶点更重要或对于用户而言最重要。 As it doesn't know that, there is the random start vertex selection. 众所周知,存在随机起始顶点选择。

You can select a different start/center vertex by clicking on the filter icon in the top right of the graph viewer. 您可以通过单击图形查看器右上方的过滤器图标来选择其他起始/中心顶点。 This will bring up a search input field that you can use to select a start vertex by any attribute (eg name == Homer if your vertices contain a name attribute). 这将显示一个搜索输入字段,可用于通过任何属性(例如,如果顶点包含name属性,则name == Homer选择起始顶点。

If such vertex exists, it will be put into the center of the screen, along with all its directly connected vertices. 如果存在这样的顶点,它将连同其所有直接连接的顶点一起置于屏幕的中心。 Note that only relationships/edges from the start vertex to its directly connected vertices will be shown. 请注意,将仅显示从起始顶点到其直接连接的顶点的关系/边。 Indirect connections will not be shown in the graph viewer by default. 默认情况下,间接连接不会显示在图形查看器中。 Clicking on any of the vertices displayed will expand (or contract) them and may bring up further relationships. 单击显示的任何顶点将扩展(或收缩)它们,并可能建立进一步的关系。

Again all of this is done because it may not be possible to display the entire graph at start (imagine a graph with a few million nodes). 再次完成所有这些操作是因为在开始时可能无法显示整个图(想象一个有几百万个节点的图)。 But as your question indicates, the current solution may not be intuitive. 但是正如您的问题所示,当前的解决方案可能并不直观。

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

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