Arrange: automatic layout of a Neo4j graph model
One click on Arrange, under Add node and Add note in the side panel, repositions the nodes so that as few relationships as possible cross each other. Nothing you didn't include is moved.
What it optimizes
toro4n places the nodes in a grid and searches for the placement with the fewest crossing relationships, then the fewest relationships running straight over another node, then the shortest total length. The search is deterministic, so the same model gives the same result, and it starts from the current positions, among others, so a good layout isn't thrown away. The nodes then glide into place, and the whole arrangement is one undo step.
Which nodes move
If at least two nodes are selected, only they are arranged. Otherwise all visible, unlocked nodes are. Everything else is an obstacle: locked nodes, unselected nodes, nodes in hidden layers, and unattached notes stay where they are, and the new picture is placed at the nearest open spot. Attached notes move with their nodes; a note on a relationship or on several things follows their middle, and if that spot is taken it moves to the nearest open one.
Room between nodes
Every column and row is as large as its nodes need, with labels, properties, and attached notes counted in. The gap between nodes is at least 220 px and always enough for the longest relationship type to fit between them with a margin, so no text ends up on top of a node.
When nothing changes
If the crossings can't be reduced, the picture is left as it is, with a message that says so. The exception is nodes lying on top of each other: those are pulled apart even when no relationships cross, as long as the crossings don't become more. In a large model it isn't possible to remove every crossing; the goal is to minimize them.
Placing new things
The same placement is used when an AI assistant draws a model, and when the structure of a Neo4j database is imported: new nodes go next to what they connect to, with room for the relationship's name, and nothing you placed yourself is moved unless the assistant is asked to arrange.