# Calculating connectivity of region?

I have some regions that I have defined and all the public transit in the State, shown here:

The blue blobs are the regions, points are the bus/tram stops, and the lines are the routes.

I want to calculate how many other regions each region can access. The way I could think to do it is to spatial join the regions to the routes and then spatial join the routes to the region and getting a sum of the join count, but this would lead to the same regions being counted.

So that doesn't work. Then I thought maybe I could use a field calculation to calculate the reachable regions. So I was able to join the `"Region_ID"` number, `"Trip_Id"` number, to the stop points. But I still have the same problem with duplicates inflating the connectivity count.

Does anyone have any ideas to solve this problem?

• are you interested in direct connexions or indirect connexion (connected to a region through another region)? Mar 19, 2019 at 14:44
• Direct connections, on if it has a stop. Mar 19, 2019 at 15:01
• Direct connection, I have a shp of the regions with te regions that dont have a stop inside excluded. Mar 19, 2019 at 15:30

maybe not the most straightfoward method here, but feasible in a reasonable number of steps without using a script :

Use spatial join to get the values of the regions for each line (one to many, with field merge rules to "min" and "max" of the field with the region ID

add a new field and concatenate the min and max with an undescore, e.g.

`````` str(!minRegionID!) + "_" + str(!maxRegionID!)
``````

summarize this table on the concatenated field

split the concatenated field in two field

summarize each field and get the sum of both counts: this is your final number

Remark : for a script, I would loop on the selection of routes intersecting one region (one region at the time), then the regions intersecting the selected routes, then counting the selected features (minus one)

Another approach to this problem is to convert your route lines to a network and then work out the valency values, this would be the number of direct connections to the bus stop. This sort of connectivity question has been asked before on GIS SE, an example is here. If you have VBA installed you could take advantage of the inbuilt map topology functionality in ArcMap, I provided some code. If you want to go down the python route then consider exploring networkx module.