A major advantage of the symmetrical layout is that it is very easy to be tuned. The most common tuning is to specify the desired distance (length between the vertices centers):
C# |
Copy Code
|
---|---|
// set the desired distance
symmetricalLayout.DesiredDistanceForce.DesiredDistance = 200;
|
Visual Basic |
Copy Code
|
---|---|
' set the desired distance
symmetricalLayout.DesiredDistanceForce.DesiredDistance = 200
|
Another common consideration with the symmetrical layout is compactness. The layout can be easily compacted by enabling the gravity force:
C# |
Copy Code
|
---|---|
// enable gravity force to increase compactness symmetricalLayout.GravityForce.Enabled = true; |
Visual Basic |
Copy Code
|
---|---|
' enable gravity force to increase compactness symmetricalLayout.GravityForce.Enabled = True |
The following image illustrates the result of the symmetrical layout with enabled gravity:
figure 2. Symmetrical layout with gravity force enabled
In rare cases when the graph admits a drawing with uniform edge direction you may also consider enabling the magnetic field force. The following example creates a magnetic field with parallel downward direction and unidirectional magnetization type:
C# |
Copy Code
|
---|---|
// configure a magnetic field force symmetricalLayout.MagneticFieldForce.Enabled = true; symmetricalLayout.MagneticFieldForce.FieldDirection = MagneticFieldDirection.ParallelDownward; symmetricalLayout.MagneticFieldForce.MagnetizationType = MagnetizationType.Unidirectional; |
Visual Basic |
Copy Code
|
---|---|
' configure a magnetic field force symmetricalLayout.MagneticFieldForce.Enabled = True symmetricalLayout.MagneticFieldForce.FieldDirection = MagneticFieldDirection.ParallelDownward symmetricalLayout.MagneticFieldForce.MagnetizationType = MagnetizationType.Unidirectional |
The following image illustrates the result of the symmetrical layout with disabled/enabled magnetic field:
Figure 3. Normal symmetrical layout used to display a binary tree.
Figure 4. Symmetrical layout with a parallel downward magnetic field and unidirectional edge magnetization.