Exporting Adjacency or Edge Connection Matrix

9595
10
08-26-2013 09:38 AM
PeteWillette
New Contributor
Hello,

I am fairly new to ArcGIS and am looking to obtain some network connectivity data in the form of an adjacency matrix or edge connection matrix with specific focus on a network of roads. I know that ArcGIS utilizes this data somewhere, but I would like to be able to have this matrix be exported to either an excel or text document. I have run the Network Analyst Tool and obtained a network with all of the junctions and edges but am not able to extract this information from ArcGIS. I have found what seems like a viable solution in Visual Basic (http://forums.esri.com/thread.asp?c=93&f=1944&t=186348). However, I am unable to execute the code due to my lack of knowledge in that language and the difficulty in setting up VB with ArcGIS 10. My knowledge in Python is limited as well. Python seems to be a little bit more straight forward to utilize with GIS, so  I was wondering if someone might be able to assist me in creating a Phython script that could obtain this connectivity matrix?

I thank you ahead of time for any advice or resources that you might point me toward in the future.

Best Wishes,

Pete
Tags (3)
0 Kudos
10 Replies
IvarBaldvinsson
New Contributor
Hello

I'm in similar position as Pete and also an ArcGIS newbie. I am considering generating district heating network using the network analyst tool, connecting each building. The network basically consists of nodes (or sinks) for buildings and edges (network pipeline) connecting the nodes. I want to extract information about interconnection of nodes, network length between nodes and floor area of buildings (nodes) to use in matrices for network design and operation in matlab.
I would like to know if it's possible to generate a connectivity or adjacency matrix or graph containing the nodes and interconnecting edges that I can export from ArcGIS?

I assume I can allocate building floor area and network length between nodes to corresponding components (nodes and edges) of the connectivity matrix using the object ID, giving that the object ID is attached with the connectivity matrix.

Perhaps another tool is better for this kind of work?

Any response or tip on the potential of doing this and how to go about doing this is highly appreciated.

Cheers,
Ivar
0 Kudos
RamB
by
Occasional Contributor III
Yes it is possible.

you should use OD matrix with some tweaking to do this. Make sure that your accumulation field is number of segments instead of distance. create a new field on your line layer and give all your lines a value of 1, and take this field to accumulation. secondly make sure that your network is cleaned properly such that end points connect properly and you have an end point connectivity in network. then make all your nodes as origins and all your nodes as destinations. Run OD matrix and you will get a matrix. All values that are 1 will give you and adjacency matrix and all those that accumulated more than 1 are not contagiously connected (not adjacent).

For this to work you should have all nodes at (blue) intersections/junctions and not in between nodes /(red) junctions, else you first have to merge such lines into one. Please see attached picture.

There is another more complex way of doing this where you will be able to define what is a node and then run the analysis with a different kind of accumulation to get an adjacency matrix.
0 Kudos
IvarBaldvinsson
New Contributor
Brilliant! Thanks for your helpful post.

I understand the basis behind this, however as I have never created OD matrix before I can not completely imagine what information the matrix will contain.
Will accumulating number of segments instead of length still allow me to see the length of each line segment, distance between nodes/junction, in the matrix? I'm interested in that to calculate temperature and pressure loss between consumers.
Also, will the matrix contain the attributes of each node? I'm interested in each building floor area that I have calculated for each building and will use that to estimate the thermal demand of each consumer.

Anyway I will carry out according to your advice at least generating the adjacency matrix.

Thanks a lot,
Ivar
0 Kudos
RamB
by
Occasional Contributor III
Too many questions you ask. I am confused. 😞

For now, yes you can accumulate as many attributes as possible, but not simultaneously. od matrix gives you : from_node, to_node, accumulated_field

you can run od matrix each time with a different accumulated_field.

may be you should break your questions, i do not understand them properly.

regards,
0 Kudos
RamB
by
Occasional Contributor III
You may also be interested in geometric network and utility analyst if you are dealing with utility networks.

regards
0 Kudos
IvarBaldvinsson
New Contributor
Thank your for your quick response.
I'll try to be more specific about this. My aim of using ArcGIS is to retrieve topology and spatial information in a matrix/vector form that I can use in different software for optimization modelling.
I have two layers (shape files), one containing building information as polygons that contains floor area of each building as attribute. Second layer contains street layout as lines. I will combine these two and use for creating a network layout where each building is a node (destination and origin) and the pipe network (using the street layout) represents the edges connecting the nodes. The resulting network layout would be something like the attached figure shows.
Basically I want to retrieve three types of data from the network in ArcGIS.

1. Adjacency (connectivity) matrix for generating the network topology showing which nodes are interconnected in the network. I seem to be able to do this by generating OD matrix accumulating number of line segments as you have explained.

2. Length of pipeline between nodes (buildings), i.e. length of line segments. Therefore I want to know if the OD matrix contains length of line segment between nodes/junctions even though the OD matrix accumulates number of line segments? But as you stated I guess I can make another OD matrix accumulating length with each node (building) as origin and destination and then find length between adjacent nodes by using the adjacency matrix from point 1.

3. Each building (node) contains its floor area as an attribute (area of polygon and nr. of floors) that I would like to retrieve as well. Therefore I'm interested in knowing if the OD matrix can contain the node (building) attributes, in this case the floor area? If not I assume I can allocate floor area to corresponding node of the adjacency matrix from pt. 1 by using building object ID.

I hope this is a bit more understandable. I had considered using Geometric network but if I can retrieve these data my needs are satisfied so I though network analyst might do the trick.

Thanks a lot for your help.
Ivar
0 Kudos
RamB
by
Occasional Contributor III
OD matrix can only accumulate attributes as I written before. If you want total area of all the buildings on your pipe network (adjacency matrix) it is possible. OD matrix is powerful if used logically.

so yes, all 3 are possible.

In case three, I suggest the following:

1. Make a «new» layer of buildings, such that these new buildings have an attribute : floor area
the location of these buildings should be just a little bit inside of your previous nodes into the network


2. Make a new attribute in your street network, also called: floor area
Use accumulation on: floor area
then you get total floor area of all the buildings on that route. in this case will be the total area of first and last node (if you make intermediate nodes floor area attribute to zero)

regards,
0 Kudos
IvarBaldvinsson
New Contributor
Great! I'm starting to get better understanding of the functionality of the OD matrix tool.

Thanks a lot for your helpful advice.

Cheers,
Ivar
0 Kudos
Diego_FabianPajarito_Grajales
New Contributor II

I was trying with the solve OD matrix, I really got tired and decided to make it using the old way

Two cursors that goes first for each line, then get the two points that intersects it and change that position in a zero matrix

you can find it at github​

pythonScripts/adjacencyMatrix.py at master · diegopajarito/pythonScripts · GitHub

Diego P

0 Kudos