Skip To Content

Apply Force Directed Layout

Summary

Emphasizes loops contained in a network diagram.

Caution:

If you have an open edit session, you must save your edits prior to running this tool. This ensures the diagram reflects the latest changes made to the network topology in the database. If you fail to save your edits, the edits will not be reflected in the diagram.

Note:

Each layout algorithm includes default parameter values. The default parameter values will be used unless otherwise specified. If the input network diagram is based on a template for which this layout has been configured with a different parameter value, that value is used instead.

Usage

  • This layout algorithm uses a physical analogy to draw graphs by considering a graph a force system in which it tries to locally minimize the energy. It searches for an equilibrium state of the force system—a position for each diagram junction where the total force on each junction is zero.

  • Because this algorithm has a tendency to emphasize loops contained in a network diagram, it is often used by operators who manage highly meshed networks, such as water, wastewater, or gas.

Syntax

ApplyForceDirectedLayout_un (in_network_diagram_layer, {are_containers_preserved}, {iterations_number}, {repel_factor}, {degree_freedom}, {breakpoint_position}, {edge_display_type})
ParameterExplanationData Type
in_network_diagram_layer

The network diagram where the layout will be applied.

Diagram Layer
are_containers_preserved
(Optional)

Specifies how containers will be processed by the algorithm.

  • PRESERVE_CONTAINERS The layout algorithm executes on the top graph of the diagram so containers are preserved.
  • IGNORE_CONTAINERSThe layout algorithm executes on both content and noncontent features in the diagram. This is the default.
Boolean
iterations_number
(Optional)

Specifies the number of iterations to process. The default is 20.

Long
repel_factor
(Optional)

Adds distance between diagram junctions that are close together. The larger the repel factor, the greater the distance that will be added between nearly overlapping diagram junctions. The default is 1.

Double
degree_freedom
(Optional)

Limits the area used to move the diagram junctions during each algorithm iteration.

  • LOWThe area used to move the diagram junctions will be very limited. This is the default.
  • HIGHThe area used to move the diagram junctions will be very large.
  • MEDIUMThe area used to move the diagram junctions will be moderate.
String
breakpoint_position
(Optional)

The relative position of the two inflexion points that will be inserted along the diagram edges to compute the curved edges geometry when Edge Display Type is set to Curved edges (edges_display_type="CURVED_EDGES" in Python). It is a percentage between 15 and 40; 30 by default. With a Break Point Relative Position (%) value of N between 15 and 40:

  • X being the x-coordinate of the edge's from junction and Y being the y-coordinate of the edge's to junction for a horizontal tree:
    • The first inflexion point will be positioned at N% of the length of the [XY] segment
    • The second inflexion point will be positioned at (100 - N)% of the length of the [XY] segment
  • Y being the y-coordinate of the edge's from junction and X being the x-coordinate of the edge's to junction for a vertical tree:
    • The first inflexion point will be positioned at N% of the length of the [YX] segment
    • The second inflexion point will be positioned at (100 - N)% of the length of the [XY] segment

Note:

The notion of the from and to junctions above is relative to the tree direction; it is unrelated to the topology of the network feature edge.

This parameter is ignored when Edge Display Type is set to Regular edges (edges_display_type="REGULAR_EDGES" in Python)

Double
edge_display_type
(Optional)

The type of display for the diagram edges.

  • REGULAR_EDGESAll diagram edges display as straight lines. This is the default.
  • CURVED_EDGESAll diagram edges are curved.
String

Code sample

ApplyForceDirectedLayout example (Python window)

Apply the Force Directed Layout algorithm to the Temporary Diagram diagram.

import arcpy
arcpy.ApplyForceDirectedLayout_un("Temporary Diagram", "PRESERVE_CONTAINERS", 
                                  20, 1, "LOW", 25, "CURVED_EDGES")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • ArcGIS Desktop Basic: No
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics