Glib.Graphs.Layouts.Layered_Layouts

Entities

Generic formal parameters

Subprograms

Description

Dummy_Vertex

type Dummy_Vertex is new Base_Dummy_Vertex with private;

Type to use for dummy vertices. This parameter can generally be set to Base_Dummy_Vertex itself, unless you override Replaced_With_Dummy_Vertices and need custom attributes in dummy vertices. If you are using a type other than Base_Dummy_Vertex, then Set_Position will be called on that vertex

Layout

procedure Layout
  (G                    : in out Graph;
   Horizontal           : Boolean := True;
   Space_Between_Layers : Gdouble := 20.0;
   Space_Between_Items  : Gdouble := 10.0)

Set the position of the vertices so that they are organized into layers. For a horizontal layout, a vertex will always be in a column to the right of all its ancestor vertices. For a vertical layout, a vertex will always be in a row below all its ancestor vertices.

This code is provided as an example. It might be changed (or even removed) in the future. Such layout algorithms are heuristics, there is no exact algorithm that would give the perfect layout.

Parameters
G
Horizontal
Space_Between_Layers
Space_Between_Items

Replaced_With_Dummy_Vertices

procedure Replaced_With_Dummy_Vertices
(Replaced_Edge : Edge_Access;
Dummies       : Vertices_Array)

The layout algorithm may have to create dummy vertices to break long edges that span multiple layers. This is used to reserve space for these edges. This procedure is called when a long edge is broken down into smaller edges. The edge is replaced with several edges: Get_Src (Replaced_Edge) --> Dummies (1) --> Dummies (2) -> ... -> Get_Dest (Replaced_Edge)

You can use this procedure if you want to do the same replacement in your own graph, perhaps to show the dummy vertices to the user. When the procedure is called, the dummy vertices have already been allocated (of type Dummy_Vertex), but you might need to further initialize them if you have added specific fields.

Parameters
Replaced_Edge
Dummies