Add Force Directed Layout (Network Diagram)

Summary

Adds the Force Directed Layout algorithm to the list of layouts to be automatically chained at the end of the building of diagrams based on a given template. This tool also presets the Force Directed Layout algorithm parameters for any diagram based on that template.

This layout algorithm uses a physical analogy to draw graphs by identifying 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.

Learn more about the Force Directed layout algorithm

Caution:

This tool is a configuration and administration tool.

Note:

This tool impacts the consistency of any existing diagrams based on the input diagram template. All of the existing diagrams become inconsistent and open with a consistency warning icon Diagram to update until they are updated.

Usage

  • This tool is not supported when working with a utility network or trace network service. You must use either a utility network or trace network in a file or mobile geodatabase, or a database connection to a utility network or trace network in an enterprise geodatabase. When working with an enterprise geodatabase, the following are requirements:

  • To preset the layout algorithm parameters for a diagram based on the diagram template, uncheck the Active parameter (is_active = "INACTIVE" in Python).

  • Run the tool with Active checked (is_active = "ACTIVE" in Python) if you want the layout algorithm to be added to the list of layouts that will be automatically chained at the end of diagram generation based on the input diagram template.

Parameters

LabelExplanationData Type
Input Network

The utility network or trace network containing the diagram template that will be modified.

Utility Network; Trace Network
Input Diagram Template

The name of the diagram template that will be modified.

String
Active

Specifies whether the layout algorithm will automatically run when generating diagrams based on the specified template.

  • Checked—The added layout algorithm will automatically run during the generation of any diagram that is based on the Input Diagram Template parameter value. This is the default.

    The parameter values specified for the layout algorithm are used to run the layout during diagram generation. They are also loaded by default when the algorithm is to be run on any diagram based on the input template.

  • Unchecked—All the parameter values currently specified for the added layout algorithm will be loaded by default when the algorithm is to be run on any diagram based on the input template.

Boolean
Preserve container layout
(Optional)

Specifies how the algorithm will process containers.

  • Checked—The layout algorithm will apply to the top graph of the diagram so containers are preserved.
  • Unchecked—The layout algorithm will apply to both content and noncontent features in the diagram. This is the default.

Boolean
Number of Iterations
(Optional)

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 of Freedom
(Optional)

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

  • LowThe area used to move the diagram junctions will be limited. This is the default.
  • HighThe area used to move the diagram junctions will be large.
  • MediumThe area used to move the diagram junctions will be moderate.
String
Break Point Relative 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; the default is 30. For example, with a Break Point Relative Position (%) parameter value of N between 15 and 40, the following is true:

  • 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 concept of the from and to junctions above is relative to the tree direction; it is not related to the topology of the network feature or object edge.

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

Double
Edge Display Type
(Optional)

Specifies 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

Derived Output

LabelExplanationData Type
Output Network

The updated utility network or trace network.

Utility Network; Trace Network
Output Diagram Template

The name of the diagram template.

String

arcpy.nd.AddForceDirectedLayout(in_utility_network, template_name, is_active, {are_containers_preserved}, {iterations_number}, {repel_factor}, {degree_freedom}, {breakpoint_position}, {edge_display_type})
NameExplanationData Type
in_utility_network

The utility network or trace network containing the diagram template that will be modified.

Utility Network; Trace Network
template_name

The name of the diagram template that will be modified.

String
is_active

Specifies whether the layout algorithm will automatically run when generating diagrams based on the specified template.

  • ACTIVEThe added layout algorithm will automatically run during the generation of any diagram that is based on the template_name parameter value. This is the default.The parameter values specified for the layout algorithm are used to run the layout during diagram generation. They are also loaded by default when the algorithm is to be run on any diagram based on the input template.
  • INACTIVEAll the parameter values currently specified for the added layout algorithm will be loaded by default when the algorithm is to be run on any diagram based on the input template.
Boolean
are_containers_preserved
(Optional)

Specifies how the algorithm will process containers.

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

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)

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

  • LOWThe area used to move the diagram junctions will be limited. This is the default.
  • HIGHThe area used to move the diagram junctions will be 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; the default is 30. For example, with a Break Point Relative Position (%) parameter value of N between 15 and 40, the following is true:

  • 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 concept of the from and to junctions above is relative to the tree direction; it is not related to the topology of the network feature or object edge.

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

Double
edge_display_type
(Optional)

Specifies 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

Derived Output

NameExplanationData Type
out_utility_network

The updated utility network or trace network.

Utility Network; Trace Network
out_template_name

The name of the diagram template.

String

Code sample

AddForceDirectedLayout example (Python window)

Add the Force Directed Layout algorithm as an automatic layout to the MyTemplate1 template related to the input network.

import arcpy
input_Network = "D:/MyProjectLocation/MyDatabaseConnection.sde/MyDatabase.MAP.Electric/MyDatabase.MAP.Electric"
input_DiagramTemplate = "MyTemplate1"

arcpy.AddForceDirectedLayout_nd(input_Network, "MyTemplate1", "ACTIVE", 
                                "PRESERVE_CONTAINERS", 20, 1, "LOW", "25", 
                                "CURVED_EDGES")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics