Find Subnetworks

The Find Subnetworks tool finds all disconnected networks (i.e. “subnetworks”) within a polyline shapefile, and labels all stream features within each disconnected network with a unique identifier code. The tool assumes that the input stream network is (or is derived from) a USGS NHD flowline dataset. The tool can optionally find topological errors within the input network, including:

  • Duplicate reaches
  • Confluence errors
  • Multiple outflows

Illustrated examples of topographic error

Error Type Example
Duplicate reaches error_duplicate
Confluence errors error_confluence
Multiple outflows error_outflow



  • ArcGIS: version 10.4 or higher
  • GDAL: A separate installation of the Geospatial Data Abstraction Library is required by this tool, in order to directly convert between shapefiles and NetworkX graphs. Because GNAT users must operate ArcGIS in a Windows environment, we strongly recommend that the user installs GDAL separately using the Windows binaries offered by Tamas Szekeres at GISInternals. Detailed instructions for installing the GDAL binaries area available here.
  • NetworkX 1.11: Please note, GNAT has only been tested with version 1.11. Other versions have not been tested and are not currently supported.

Input Parameters


Input stream network shapefile

Stream network shapefile representing a drainage network. Ideally this network should be a USGS NHD flowline dataset, or derived from NHD. Also, all canal and pipeline features (i.e. FType = 336 or FType = 428) MUST be removed prior to running the tool. Removing these features will create disconnected subnetworks within the overall stream network, each of which will be assigned a unique identifier code by the tool.


Output shapefile

Stream network polyline shapefile generated by the tool, which will include new attribute fields. These new attribute fields include:

  • _FID_ : unique identifier for each line feature
  • _netid_ : unique identifier for each subnetwork

Find topology errors (optional)

If this option is selected, the Find Subnetworks tool will attempt to find and label topological errors. New attribute fields will be added to the output shapefile, including:

  • _err_dupe_ : boolean value indicates if the line feature is a duplicate of another feature (based on calculate length).
  • _err_conf_ : boolean value indicates if the line feature has an upstream flow direction.
  • _err_out_ : boolean indicates either a problem with flow direction (multiple reachs flowing to the same node) or a subnetwork where the number of outflow features != 0.

Technical Background

Calculation Method

The Find Subnetworks tool relies on the excellent NetworkX python library, which is in turn based on graph theory concepts. The tool converts the input stream network shapefile into a graph object (composed of “edges” and “nodes”), which is how the file is then processed throughout the workflow, until being converted back into a shapefile.



After the Find Subnetworks tool is finished processing, the user can decide which subnets should remain disconnected from the main network, and which should be edited so that they are connected. Subnetworks can be visualized in ArcMap using the _netid_ attribute field. In addition, the location of topological errors within the subnetworks can be reviewed by symbolizing the _err_dupe_, _err_conf_, and _err_out attribute fields in the output shapefile. The user can then utilize ArcMap editing tools to manual edit these features if they are actual topological errors.

This process can then be repeated by running the repaired stream network shapefile through the Find Subnetworks tool to find any missed errors.

Troubleshooting and Potential Issues

The errors found by the Find Subnetworks tool should only be viewed as potential errors. Whether or not a stream feature actually has a topological error, and how it should be corrected, is up to the user and should be determined on a case-by-case basis. In addition, stream reach features that are adjacent and/or nearby should also be examined.