ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MappingExtensions Class / BuildMapTopologyGraph Method / BuildMapTopologyGraph<T>(MapView,Action<TopologyGraph>) Method
The map view.
The client action that receives a ArcGIS.Core.Data.Topology.TopologyGraph as input for analysis.
Example

In This Topic
    BuildMapTopologyGraph<T>(MapView,Action<TopologyGraph>) Method
    In This Topic
    Build the Map Topology Graph.
    Syntax
    public static void BuildMapTopologyGraph<T>( 
       MapView mapView,
       Action<TopologyGraph> action
    )
    Public Overloads Shared Sub BuildMapTopologyGraph(Of T)( _
       ByVal mapView As MapView, _
       ByVal action As Action(Of TopologyGraph) _
    ) 

    Parameters

    mapView
    The map view.
    action
    The client action that receives a ArcGIS.Core.Data.Topology.TopologyGraph as input for analysis.

    Type Parameters

    T
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Build Map Topology
    private async Task BuildGraphWithActiveView()
    {
      await QueuedTask.Run(() =>
      {
        //Build the map topology graph
        MapView.Active.BuildMapTopologyGraph<TopologyDefinition>(async topologyGraph =>
        {
          //Getting the nodes and edges present in the graph
          var topologyGraphNodes = topologyGraph.GetNodes();
          var topologyGraphEdges = topologyGraph.GetEdges();
    
          foreach (var node in topologyGraphNodes)
          {
            // do something with the node
          }
          foreach (var edge in topologyGraphEdges)
          {
            // do something with the edge
          }
    
          MessageBox.Show($"Number of topo graph nodes are:  {topologyGraphNodes.Count}.\n Number of topo graph edges are {topologyGraphEdges.Count}.", "Map Topology Info");
        });
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also