Customer Service | Training | Contact Us
You are here: Home > User Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Extension - Network Analyst forum

how to create an adjacency matrix   Simone Caschili Mar 28, 2006
Re: how to create an adjacency matrix   Simone Caschili Mar 30, 2006
Re: how to create an adjacency matrix   Michael Rice Mar 30, 2006
Re: how to create an adjacency matrix   Simone Caschili Mar 30, 2006
Re: how to create an adjacency matrix   Michael Rice Mar 31, 2006
Re: how to create an adjacency matrix   Jay Sandhu Apr 03, 2006
Re: how to create an adjacency matrix   Simone Caschili Apr 05, 2006
Re: how to create an adjacency matrix   Simone Caschili Apr 12, 2006
Re: how to create an adjacency matrix   Simone Caschili Apr 16, 2006
New issue   Simone Caschili Apr 19, 2006
Re: New issue   Simone Caschili Apr 19, 2006
Re: how to create an adjacency matrix   Alisa Coffin Feb 13, 2008
Re: how to create an adjacency matrix   Simone Caschili Feb 13, 2008
Re: how to create an adjacency matrix   Alisa Coffin Feb 16, 2008
Re: how to create an adjacency matrix   Alisa Coffin Feb 18, 2008
Re: how to create an adjacency matrix   Eric Werfel Mar 10, 2008
Re: how to create an adjacency matrix   Alan Hatakeyama Mar 10, 2008
Re: how to create an adjacency matrix   Tony Kelava Oct 12, 2008
Re: how to create an adjacency matrix   Alan Hatakeyama Oct 14, 2008
Re: how to create an adjacency matrix   Tony Kelava Oct 20, 2008
Report Inappropriate Content • Top • Print • Reply    
Subject how to create an adjacency matrix 
Author Simone Caschili 
Date Mar 28, 2006 
Message Hello!

I've built a network dataset(working with ArcGis 9.1) from an existing dataset (polyline shapefile) that reppresents a street network ... I want to know if it is possible to get an adjacency matrix of my network dataset; the adjacency matrix is a matrix where I get a number of rows and coloumns equal to the total number of the nodes of my network; each matrix's cell is equal to 1 if two nodes are connected each other, 0 if they are not.

hope someone can help me !!
thank you !! 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Mar 30, 2006 
Message I've found an example of what i mean with "adjacency matrix" ... here you are the link http://www.cs.usask.ca/resources/tutorials/csconcepts/1999_8/tutorial/beginner/matrices/matrix.html

I've looked for a kind of script for many days, but it seems none have never tried to solve this issue ... is it possible this kind of matrix has got a different name in the GIS field?

thank you so much for any answer!! 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Michael Rice 
Date Mar 30, 2006 
Message Simone,

What exactly do you need an adjacency matrix for? This is usually used to perform some low-level graph traversal analysis, most of which Network Analyst already provides through its solvers. What you are asking for is not available out-of-the-box through the Network Analyst user interface, because most users don't need an adjacency matrix as output. However, you can programmatically create your own adjacency matrix using some of the lower-level ArcObjects components related to the network dataset. If you are interested in creating your own adjacency matrices through code, then you should get familiar with the NetworkForwardStar object. Using the NetworkForwardStar object in your code, you can query and adjust the adjacency/connectivity/traversability of network elements in your network for particular usage. Let me know if you need any more information on this. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Mar 30, 2006 
Message Micheal,

I'm working towards my thesis on complex network (free scale network, small world and so on ...); exactly i'm trying to apply this theory to a geogrphical network (a street network in this case); I have found some papers about complex network, and they usually use an adjacency matrix to store the data. Then they make some analysis (often topological analysis) using the adjacency matrix they have built. This is my work in few words!!

I've got a questions for you: what does is "NetworkForwardStar object"? is it a kind of programming language? could you link me some guides? my big problem in this case is that I've only a small knowledge about C programming ... so as i thought it is necessary I start studying one of the language that I can use on ArcGIS!! 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Michael Rice 
Date Mar 31, 2006 
Message Simone,

It's good to hear that you are doing some thesis work on network models. As for the NetworkForwardStar object, it is one of the many ArcObjects programming components. ArcObjects are the component technology that the ArcGIS framework is built on top of. Essentially, they are the software building blocks for ESRI's ArcGIS family of products. It is not a programming language. It is pretty much language independent, meaning that you can make use of this component (and the others) in any of the major programming languages today (e.g., C++, C#, VB.NET, etc.).

Here is a link to more information on the NetworkForwardStar component:

http://edndoc.esri.com/arcobjects/9.1/default.asp?URL=/arcobjects/9.1/ComponentHelp/esriGeoDatabase/NetworkForwardStar.htm

Here is an additional link to our ESRI Developer Network library reference, in case you are interested in learning more about these ArcObjects components and how to programmatically work with them to achieve your own tasks:

http://edndoc.esri.com/arcobjects/9.1/

If you wish to learn a new language that is quick and easy to use within the ArcGIS framework, then I would suggest something like C#. C# has much of the same C-based syntax that you are probably already familiar with, but it is fully object-oriented and much more intuitive to learn. Here are some specific code samples that make use of the Network-Analyst-specific and Network-Dataset-specific ArcObjects components to perform certain tasks programmatically (most of these are in VB6, but hopefully, they aren't too tough to translate to C# or even VB.NET):

http://edn.esri.com/index.cfm?fa=codeExch.querySamples&activeTab=samples&resultsFromCount=1&SelectedType=All&SelectedCategory=NetworkAnalyst&SelectedVersion=9.1&resultsPerPage=20&selectedOrder=Name

Hope this helps. Let me know if you have any more questions. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Jay Sandhu 
Date Apr 03, 2006 
Message Simone,
Here is a simple VBA that will list out the adjacent nodes for every node in the network. You can adapt the output to whatever format you want the adjacency matrix to be in. Also do note that this routine prints out EID's. You may also want OIDs. To use it, add a network dataset to ArcMap and run it through VBA.
Jay Sandhu 
 
Public Sub List_Adjacent_Junctions()
On Error GoTo eh

  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)
    
  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
  Set pNE = pEnumNE.Next

  Dim pNEJunc As INetworkJunction
  Set pNEJunc = pNE
  
  Dim i As Integer
  Do Until pNE Is Nothing
    Debug.Print "Junction: " & pNEJunc.EID & " is adjacent to: " & pNEJunc.EdgeCount & " junctions."
    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
      Debug.Print "Adjacent Junction: " & pNEToJunc.EID  'List the adjacency
    Next
    Set pNE = pEnumNE.Next
  Loop
  Exit Sub
eh:
  MsgBox "Error: " & Err.Description
End Sub
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Apr 05, 2006 
Message Jay,

thank you very much for your answer, but what you suggested me it is different from that i want to get !
I have found a script that works as well as I want, but it calculates the distance between every point on the net ... perhaps if i show you it you can help me ! here you are the script, look I have commented (I mean I put ' ) in the code where i think i don't need ! and I have written as pseudocode the part that i'm not able to solve ! 
 
Public Sub PointPoint()

Dim pMxApplication As IMxApplication
Dim pMxDocument As IMxDocument
Dim pPoint1 As IPoint
Dim pPoint2 As IPoint
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureClass As IFeatureClass
Dim pFeature1 As IFeature
Dim pFeatureCursor1 As IFeatureCursor
Dim pFeature2 As IFeature
Dim pFeatureCursor2 As IFeatureCursor
'Dim x1, y1, x2, y2, d As Double
Dim pTable As ITable
Dim pRow As IRow
Dim pFeatureWorkspace As IFeatureWorkspace
Dim pWorkspace As IWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Dim pFieldsEdit As IFieldsEdit
Dim pFields As IFields
Dim pLineFeatureClass As IFeatureClass
Dim pLineLayer As IFeatureLayer
Dim strPathTable As String
Dim strNameTable As String

  'set general variables
  Set pMxApplication = Application
  Set pMxDocument = ThisDocument
  
  'get the line and point feature classes
  Set pFeatureLayer = pMxDocument.FocusMap.Layer(0)
  Set pFeatureClass = pFeatureLayer.FeatureClass
  Set pLineLayer = pMxDocument.FocusMap.Layer(1)
  Set pLineFeatureClass = pLineLayer.FeatureClass
  'point feature class has to be the first layer on TOC
  If pFeatureClass.ShapeType <> esriGeometryPoint Then
    MsgBox "Input Point Feature Class has to be the first layer on TOC"
    Exit Sub
  End If
  'line feature class has to be the first layer on TOC
  If pLineFeatureClass.ShapeType <> esriGeometryPolyline Then
    MsgBox "Output Line Feature Class has to be the first layer on TOC"
    Exit Sub
  End If
  
  'ask for the name (strNameTable) and the path of the point-point table (strPathTable)
  strPathTable = InputBox("Insert Table's Path:", "Table's Path", "c:\temp")
  strNameTable = InputBox("Insert Table's Name:", "Table's Name: *.dbf", "point_point")
  
  'to write the table it will be used a SWF (dbf table)
  Set pWorkspaceFactory = New ShapefileWorkspaceFactory
  Set pWorkspace = pWorkspaceFactory.OpenFromFile(strPathTable, 0)
  Set pFeatureWorkspace = pWorkspace
  
  'this will add the table's fields
  Dim pFieldOggetto As IFieldEdit
  Set pFieldOggetto = New Field
  With pFieldOggetto
    .Type = esriFieldTypeString
    .Name = "POINT"
    .Length = 20
  End With
  Set pFieldsEdit = New Fields
  pFieldsEdit.AddField pFieldOggetto
  Set pFields = pFieldsEdit
  Set pTable = pFeatureWorkspace.CreateTable(strNameTable, pFields, Nothing, Nothing, "")
  'loop to add a field for every point
  Set pFeatureCursor1 = pFeatureClass.Search(Nothing, False)
  Set pFeature1 = pFeatureCursor1.NextFeature
  Dim i As Integer
  i = 0
  Do Until pFeature1 Is Nothing
    Dim pField As IFieldEdit
    Set pField = New Field
    With pField
      .Type = esriFieldTypeDouble
      .Name = "POINT_" & i
      pTable.AddField pField
    End With
    i = i + 1
    Set pFeature1 = pFeatureCursor1.NextFeature
  Loop
  
  'here is the main
  Set pFeatureCursor1 = pFeatureClass.Search(Nothing, False)
  Set pFeature1 = pFeatureCursor1.NextFeature
  i = 0
  Dim j As Integer
  'we are on the first row
  Do Until pFeature1 Is Nothing
    j = 0
    Set pRow = pTable.CreateRow
    pRow.Value(pTable.FindField("POINT")) = "POINT_" & i
    pRow.Store
    Set pFeatureCursor2 = pFeatureClass.Search(Nothing, False)
    Set pFeature2 = pFeatureCursor2.NextFeature
    Do Until pFeature2 Is Nothing
      'distance's calculation
      'Set pPoint1 = pFeature1.Shape
      'Set pPoint2 = pFeature2.Shape
      'x1 = pPoint1.X
      'y1 = pPoint1.Y
      'x2 = pPoint2.X
      'y2 = pPoint2.Y
      'd = (((x2 - x1) ^ 2) + ((y2 - y1) ^ 2)) ^ 0.5
        'here we create the polyline between pPoint1 e pPoint2
          'If (j >= (i + 1)) Then 'to make sure not to have zero length line and 2 lines for 2 points
            'Dim pPolyline As IPolyline
            'Set pPolyline = New Polyline
            'pPolyline.FromPoint = pPoint1
            'pPolyline.ToPoint = pPoint2
            'Dim pLineFeature As IFeature
            'Set pLineFeature = pLineFeatureClass.CreateFeature
            'Set pLineFeature.Shape = pPolyline
            'pLineFeature.Store
          'End If


'here it should start the code that i need 
if point1 is connected to point2 
      pRow.Value(pTable.FindField("POINT_" & j)) = 1
else
      pRow.Value(pTable.FindField("POINT_" & j)) = 0


      pRow.Store
      j = j + 1
      Set pFeature2 = pFeatureCursor2.NextFeature
    Loop
    i = i + 1
    Set pFeature1 = pFeatureCursor1.NextFeature
  Loop
  
  pMxDocument.ActiveView.Refresh
  
End Sub
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Apr 12, 2006 
Message Hello Jay,

I've followed the path that you suggested me and I processed the data done by the script you gave me outside Arcgis so that I got an adjacency matrix ... anyway now I've got a new problem because instead of having a matrix with 0 and 1 I want to get the edge length ... I mean, following the script that you gave me, i want to get an output as this:

[code]
Junction 1 is adjacent to 2 junctions

Adjacent Junction: 10, 1200
Adjacent Junction: 8, 982
[/code]

where 1200 is the distance on the network between the junction 1 and 10, 892 between junction 1 and 8 !!

which function can give me the length of the edge?

EDIT

I have a new information, that maybe can be usuful to solve my problem ... the point is that: my network has got some attributes from the existing shape file from which i've created it!!

On Arcmap if i select an edge with the "Identify tool" i can get its lenght from a field called "lenght" ... hope it's easiest than before finding a solution for my problem ...

Thank you very much for every answer

 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Apr 16, 2006 
Message Hej everyone!!!

I've found the solution for my last issue, it is quite easy for people who are able to program VB and so on ... anyway I'll leave the script perhaps it could be usuful to someone else ! 
 
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)
    
  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
  Set pNE = pEnumNE.Next

  Dim pNEJunc As INetworkJunction
  Set pNEJunc = pNE
  
  Dim i As Integer
  Do Until pNE Is Nothing
    Debug.Print "Junction: " & pNEJunc.EID & " is adjacent to: " & pNEJunc.EdgeCount & " junctions."
    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
      
      Debug.Print "Adjacent Junction: " & pNEToJunc.EID; ";"; pNEdge.AttributeValueByName("Length") 'List the adjacency and the edge's length
    Next
    Set pNE = pEnumNE.Next
  Loop
  Exit Sub
eh:
  MsgBox "Error: " & Err.Description
End Sub
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject New issue 
Author Simone Caschili 
Date Apr 19, 2006 
Message Hello!!

I've got a new issue and i'm not able to solve it ! I'm working on a large network and i can't see the whole output of my script on the "output box" but only the last part ! I think i can solve the problem storing the output on a text file (or kind of). I've written some lines to do it but it doesn't work !! could anyone help me? what do i need? 
 
Public Sub List_Adjacent_Junctions()
On Error GoTo eh

  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)
    
  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
  Set pNE = pEnumNE.Next

  Dim pNEJunc As INetworkJunction
  Set pNEJunc = pNE
  'here start the code to store the output on a text file
  Dim strOutputFile As String
  strOutputFile = "C:\my.txt"
  Open strOutputFile For Output As #1
  
  Dim i As Integer
  Do Until pNE Is Nothing
   Debug.Print "Junction: " & pNEJunc.EID & " is adjacent to: " & pNEJunc.EdgeCount & " junctions."
    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
      Debug.Print "Adjacent Junction: " & pNEToJunc.EID; ";"; pNEdge.AttributeValueByName("Length") 'List the adjacency and the edge's length
    Next
    Set pNE = pEnumNE.Next
  Loop
  Exit Sub
  Close #1
eh:
  MsgBox "Error: " & Err.Description
End Sub
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: New issue 
Author Simone Caschili 
Date Apr 19, 2006 
Message Ok, the solution is that: to write "Print #1," instead of "Debug.Print" 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Alisa Coffin 
Date Feb 13, 2008 
Message I am also trying to create an adjacency matrix of a transportation network. I tried the code that you show here and got an error message: Type mismatch. Can you give me a pointer or two as to how I might overcome this?

Thanks! Alisa. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Simone Caschili 
Date Feb 13, 2008 
Message do you get which function (or which line) creates the error? btw i've found this topic:

http://msdn2.microsoft.com/en-us/library/3etdkytt.aspx

Maybe it could be useful!
Simon 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Alisa Coffin 
Date Feb 16, 2008 
Message Dear Simon,

Thank you for the bit of code. I was able to get it to work on my roads network! I can now move on to the next step.

Best wishes,
Alisa. 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Alisa Coffin 
Date Feb 18, 2008 
Message I found that for my output, I really didn't need the text comments, so I pared the code down. The result is a comma delimited weighted list of adjacent junctions. I post it here for anyone else who might need this. I plan to use it as input to igraph (an R module for analysis of graphs).

Good luck!

Alisa 
 
Public Sub List_Adjacent_Junctions()
On Error GoTo eh

  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)
    
  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
  Set pNE = pEnumNE.Next

  Dim pNEJunc As INetworkJunction
  Set pNEJunc = pNE
  'here start the code to store the output on a text file
  Dim strOutputFile As String
  strOutputFile = "C:\my.txt"
  Open strOutputFile For Output As #1
  
  Dim i As Integer
  Do Until pNE Is Nothing
      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
      Print #1, pNEFromJunc.EID & ", "; pNEToJunc.EID & ","; pNEdge.AttributeValueByName("Length") 'List the adjacency and the edge's length
    Next
    Set pNE = pEnumNE.Next
  Loop
  Exit Sub
  Close #1
eh:
  MsgBox "Error: " & Err.Description
End Sub
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Eric Werfel 
Date Mar 10, 2008 
Message i'm trying to use the INetworkQuery object myself but am having problems with it.

basically, i just want to enumerate the junctions in my network, so that i can move thru them and look for flow splits in a sewer network. it seems that INetworkQuery.Elements will do what i want.

the problem is that when i get to this line in your code:

Set pNLayer = pMxDoc.FocusMap.Layer(0)

i get a type mismatch error. my first layer is part of the network i'm trying to reference. i've tried a dozen different variations, all trying to return an ILayer (which is part of the network) to set the INetworkLayer, and none work.

my only thought is that, even though the layer is part of a network, it is not an INetworkLayer for some reason

any idea why this isnt working? is there any other way for me to enumerate my junctions. i know i could just search the feature classes, but my network has 5 different junction feature classes, so i dont want to search each one individually.

thanks,

 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Alan Hatakeyama 
Date Mar 10, 2008 
Message Hi Eric,

The first layer in Alisa's case is a layer that references a network dataset, not a feature class that participates in the network.

It also sounds like you're using a geometric network and not a network dataset. If this is the case, you can access its connectivity via its logical network: IGeometricNetwork::get_Network(). You can get an enumeration of all elements in the network by calling INetwork::CreateNetBrowser(). This will get you an enumeration of EIDs for the given element type. You can access the connectivity via the methods of INetTopology.

Also, if you have any further questions regarding geometric networks, you may want to post in the "Geodatabase Geometric Networks" forum instead of in Network Analyst, as the two have nothing to do with each other.


Alan 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Tony Kelava 
Date Oct 12, 2008 
Message The code provided works a treat for what we want to do with our network, however does anyone know if its possible to get some sort of adjacency order to the code? ie. for each junction get the adjacent junctions (which the code is doing now) and order them in a clockwise direction for each junction? Is this possible? 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Alan Hatakeyama 
Date Oct 14, 2008 
Message Hi Tony,

Try taking a look at each adjacent edge's FromAzimuth (i.e., the azimuth at which each one leaves the junction) and sorting the edges by it. Azimuths start at zero in the northerly direction, and increase as you move clockwise.


Alan 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: how to create an adjacency matrix 
Author Tony Kelava 
Date Oct 20, 2008 
Message The macro returns the "EDI" for each junction which is great, can I also bring accross other attributes contained in the Junctions part of the network? I have a TCS_No and N field as part of the Junctions network.