Своей сети у меня нет, я взял какую-то сеть из туториала по десктопу, из 5го занятия.
За основу взял скрипт по приведённой Вами ссылке на форум esri:
http://forums.esri.com/thread.asp?c=93&f=1944&t=186348
Прогонял на маленьком фрагменте.
Начните тоже с маленького участка. Его и проверять легче, и результат получите быстрее.
Первый слой на карте должен быть сетью - это важно. Смотрите, как на картинке выше.
Если найдёте баги - пишите.
Public Sub List_Adjacent_Junctions()
On Error GoTo eh
' Выходной файл
OutputFile = "C:\my.txt"
' Разделитель
Separator = " "
' Показывать ли заголовки строк
ShowRowHeaders = True
' Показывать ли заголовки столбцов
ShowColumnHeaders = True
' Показывать ли саму матрицу (или можно оставить только сумму)
ShowMatrix = True
' Показывать ли сумму
ShowSum = True
' Показывать ли OID вместе с EID
ShowOID = False
'
RowColumnHeader = "\"
' Заголовок колонки суммы
SumColumnHeader = "T"
' ----------------------------------------------
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pNLayer As INetworkLayer
Set pNLayer = pMxDoc.FocusMap.Layer(0)
Dim pND As INetworkDataset
Set pND = pNLayer.NetworkDataset
Dim pNQ As INetworkQuery
Set pNQ = pND
Dim pEnumNE As IEnumNetworkElement
Set pEnumNE = pNQ.Elements(esriNETJunction)
NodeCount = pNQ.ElementCount(esriNETJunction)
'Dim arr() As Integer
'ReDim arr(NodeCount) As Integer
Dim pNEdge As INetworkEdge
Set pNEdge = pNQ.CreateNetworkElement(esriNETEdge)
Dim pNEFromJunc As INetworkJunction
Set pNEFromJunc = pNQ.CreateNetworkElement(esriNETJunction)
Dim pNEToJunc As INetworkJunction
Set pNEToJunc = pNQ.CreateNetworkElement(esriNETJunction)
Dim pNE As INetworkElement
pEnumNE.Reset
Set pNE = pEnumNE.Next
Dim pNEJunc As INetworkJunction
Set pNEJunc = pNE
'here start the code to store the output on a text file
Open OutputFile For Output As #1
Dim outputRow As String
If (ShowColumnHeaders = True) Then
If (ShowRowHeaders = True) Then
outputRow = RowColumnHeader
Else
outputRow = ""
End If
If (ShowMatrix = True) Then
IsFirst = True
Do Until pNE Is Nothing
If (IsFirst = True And ShowRowHeaders = False) Then
outputRow = pNEJunc.EID
Else
outputRow = outputRow & Separator & pNEJunc.EID
End If
If (ShowOID = True) Then
outputRow = outputRow & "(" & pNEJunc.OID & ")"
End If
IsFirst = False
Set pNE = pEnumNE.Next
Loop
End If
If (ShowSum = True) Then
If (outputRow <> "") Then
outputRow = outputRow & Separator
End If
outputRow = outputRow & SumColumnHeader
End If
Print #1, outputRow
End If
pEnumNE.Reset
Set pNE = pEnumNE.Next
Dim i As Long
Do Until pNE Is Nothing
Dim arr() As Integer
ReDim arr(NodeCount) As Integer
Sum = 0
For i = 0 To pNEJunc.EdgeCount - 1 'For each connected edge...
pNEJunc.QueryEdge i, True, pNEdge 'Get that connected edge
pNEdge.QueryJunctions pNEFromJunc, pNEToJunc 'Get To junction of current edge
arr(pNEToJunc.EID) = arr(pNEToJunc.EID) + 1
Sum = Sum + 1
'Print #1, pNEFromJunc.EID & ", "; pNEToJunc.EID & ","; pNEdge.AttributeValueByName("Meters") 'List the adjacency and the edge's length
Next
If (ShowRowHeaders = True) Then
outputRow = pNEJunc.EID
If (ShowOID = True) Then
outputRow = outputRow & "(" & pNEJunc.OID & ")"
End If
Else
outputRow = ""
End If
If (ShowMatrix = True) Then
For i = 1 To NodeCount
Value = arr(i)
If (i = 1 And ShowRowHeaders = False) Then
outputRow = Value
Else
outputRow = outputRow & Separator & Value
End If
Next
End If
If (ShowSum = True) Then
If (outputRow <> "") Then
outputRow = outputRow & Separator
End If
&nbs