Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In vis-network, how is horizontal order determined in hierarchical layout?

In this example, "level" is used to control the vertical position a node is put at (assuming hierarchical.direction is up-down).

enter image description here

However, I didn't find how to set the horizontal order for nodes on the same hierarchy. For example, if I want to put node 6 in front of node 1, is there a way to do it?

My understanding is that the horizontal order is purely determined by node insertion order, is it correct?

like image 453
laike9m Avatar asked Aug 06 '20 06:08

laike9m


People also ask

What is the direction of the hierarchical layout?

The direction of the hierarchical layout. The available options are: UD, DU, LR, RL. To simplify: up-down, down-up, left-right, right-left. The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: hubsize, directed.

How many layers are there in a hierarchical network model?

As shown below, the hierarchical network model uses three layers. These are the Core, Distribution, and Access layers. Often, these layers, map to the physical layout of the network. As you will see later, this is not always the case, so try to think of them as logical layers. The requirements and functions of each layer is different.

What is the difference between hub size and direction layouting methods?

The hub size layouting method is based on the amount of edges connected to a node. The node with the most connections (the largest hub) is drawn at the top of the tree. The direction layouting method is based on the direction of the edges. The from nodes are placed above the to nodes in the hierarchy.

How does the direction layouting method work?

The direction layouting method is based on the direction of the edges. The from nodes are placed above the to nodes in the hierarchy. Nodes that can be placed on multiple levels are by default shaken towards towards the leaves. All the leaves are then in a single line at the very bottom of the hierarchy.


Video Answer


1 Answers

According to https://github.com/visjs/vis-network/issues/926, the order is non-deterministic. Quote:

Q: I didn't find how to set the horizontal order for nodes on the same hierarchy. For example, if I want to put node 6 in front of node 1, is there a way to do it?

A: As far as the public API goes: No, the order is not guaranteed in any way, do not rely on it, it may change with any new release or between browsers.

Q: My understanding is that the horizontal order is purely determined by node insertion order, is it correct?

A: As far as the CURRENT implementation and decent browsers go: Yes.

like image 61
laike9m Avatar answered Oct 23 '22 05:10

laike9m