Layers in a Neo4j graph model

Working with a large, complex graph? Split it into layers so you can focus on one part at a time. You might keep a system's hardware and software apart, or today's model and a proposed change. Layers also make it easy to combine several graphs into a single model.

The Layers tab

Click the Layers tab in the side panel, or press L. Click New layer to add one and type its name right away; to rename a layer later, double-click its name. Each layer has an eye that shows or hides it and a lock that stops its contents from being selected or moved. Drag layers up or down to change their order. Show all and Hide all at the top apply to every layer except Notes and Properties. The layer you click becomes the active layer, where new nodes go, and toro4n remembers your choice for each model.

A node can be in several layers

When you select a node, the Layers section in the Edit tab shows a switch for each layer. Turn on as many as you need; a node always keeps at least one. A node is visible when any of its layers is visible, locked when any of them is locked, and drawn once, in the topmost of its visible layers. To put the selected nodes in a single layer, choose that layer from Move to layer… below the switches.

A duplicate goes into the same layers as the original. Drag a relationship out to an empty spot, and the new node joins the layers of the node you dragged from. Every other new node, including the ones you paste, goes into the active layer. If that layer is hidden, toro4n shows it again so you can see what you added.

Relationships and layers

A new relationship isn't in any layer, so its Layer dropdown in the Edit tab shows Default. The relationship is visible when both of its nodes are, and locked when either of them is. To put it in a layer, pick one from the dropdown. It's then visible only when that layer and both of its nodes are visible, and locked whenever the layer is. To take it out again, choose Default. If you delete the layer, the relationship is moved or deleted along with everything else in it.

Deleting a layer

When you delete a layer, you choose what happens to its contents: pick another layer under Move contents to and click Move and delete, or click Delete contents. Nodes that also belong to another layer stay there either way.

Two fixed layers

Layers and import

Every import gets its own layer. Name it under Layer for this import in the Import dialog, or leave the field blank to use the imported model's name. When you drop a file, its name is filled in for you. With Add to the open model, everything the import brings in goes into that layer, so hiding the layer hides what the import added. When an imported node merges into an existing one, the existing node joins the import's layer as well and stays in its other layers. The imported model's layers aren't carried over, but File › Open… keeps a file's layers as they are.

Layers in export

In the Export dialog, Visible layers only is on by default and leaves hidden layers out of every format. Turn it off to export everything. When you open that JSON file again, each layer is shown, hidden, or locked just as you left it.

Related