I'm in a situation where I have the exact same need - exporting the connectivity table from a geometric network. I'm curious how you ended up solving your problem. Did you go with the VB Code, or a similar python script? Or perhaps there's a newer solution that's come up in the last three years.
Also , I have the same problem . Please if you have some solutions , share it with me . I used the schematic tool , but I got some tables , regarding your images there is only a connectivity table.
Thanks in advance
Thanks for your answers. In the end I've built a python solution to export adjacency matrix and node list of a network to text files.
It requires the installation of networkX and shapely python packages. Your network has to be a shapefile, and the script was not tested on big graphs.
I have uploaded a zip file containing script, data sample and results hereHope this helps and feel free to comment !
# Extract adjacency matrix and nodelist from Shapefile with python networkX
import networkx as nx
import numpy as np
# Setting the working directory (the network .shp file has to be in this path)
path = r'Q:\gis\NetworkSample'
# Now change the directory
os.chdir( path )
# Check current working directory.
retval = os.getcwd()
print "Directory changed successfully %s" % retval
# Name of the network shapefile
shpFileName = 'SampleNetworkData.shp'
# Adjacency matrix export name
# node list export name
#Reading the shp and creating the corresponding graph G
#Converting G to an unoriented graph
# Print the number of nodes and edges
print str(G.number_of_nodes()) +" nodes" + " and " +str(G.number_of_edges()) + " edges"
#Change nodes labels by an integer that range from 0 --> n and save the old labels (XY coordinates).
# Adjacency Matrix
# Computing adjacency matrix using length as weight
# Converting CSR matrix format to dense format
# Exporting adjacency matrix as .txt file
np.savetxt("dense_adjacency_matrix_SampleNetworkData.txt", DenseAdjMatrix, delimiter=',', newline="\n", fmt='%d')
# Nodes attributes
# Exporting the nodes key and coordinates has a file ("nodelist.txt")
with open('nodeslist.txt','w') as file:
for node in G.nodes_iter(data=True):
#Identify the node key (integer) and X,Y coordinates (float) and return them in the list 'towrite'
#Setting file format (node key,X,Y) and export
towrite= ','.join(map(str, towrite))
#End of script