# How to Find if set of Polylines are Connected?

I am using ArcGIS 9.3. I have a Polyline Feature class with attribute field as Street_Name. I want to Check if for say Street_Name='My Street' (say around 10 Features from the layer) all the polylines are Connected to each other. Edges in the Layer can be complex edge with multiple vertices. Any idea ?

-

This can be achieved at least to some extent by creating a geometric network in a geodatabase (requires ArcEditor license) and then using Finding connected features on the Utility Network Analyst toolbar.

Otherwise you might like developing an Add-in (Python add-in, for instance) to create a button in the GUI and use it when you have selected the features and want to check their connectivity.

-
Thanks for the answer. But I can not create network everytime I select some records. I want to write a small snippet in ArcObjects to check if the Selected Features are CONNECTED or not. Is there a way to check this? I tried creating some logic for taking the Polylines in a Geometry collection and trying to find if its multipart. But this doesn't work for me somehow :( as my polylines are also multi start and end points (for ex. T Junctions) features – Shashank Gokhale Jan 22 '13 at 16:24
You don't have to create a geometric network every time. You create it once and then locate the flags on the network edges (which represent the selected street pieces). – Alex Tereshenkov Jan 22 '13 at 16:32
This may be of use to you. Creating a graph of connections... gis.stackexchange.com/questions/16529/… – awesomo Jan 23 '13 at 0:31

May be you can use following logic to find connected polylines:

``````1. create two dictionary: ToPointDictionary and FromPointDictionary
2. For ToPointDictionary, KeyValue = Polyline.ToPoint and
for FromPointDictionary, KeyValue = Polyline.FromPoint
3. DataValue = List<Polyline>
4. /*polyline1 = ToPointDictionary[key] and polyline2 = FromPointDictionary[key],
both keys are same*/
If (FromPointDictionary's keyValue == ToPointDictionary's KeyValue)
//Decision = polyline1 is connected with polyline2 like polyline2 is the child and
polyline1 is parent
``````
-