Algorithm to identify point connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mercus
    New Member
    • Oct 2016
    • 1

    Algorithm to identify point connection

    The dataset contains geodesic points, even spaced, which show elevations for each point. The goal identify the number of islands in the dataset. Say for a dataset which represents a map of the united kingdom there would be 2 (major islands) + a number of smaller island as the result.

    What is a good way to algorithmically acheive this?
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    mercus,

    You will have to use an adaptive algorithm that finds disjoint sets. The algorithm is recursive...

    Algorithmically , I would try the following:
    Code:
    Create three sets - non-sampled points, water, and islands. 
    non-sampled points and water are sets of raw data.
    islands is a set of sets, each entry will be an island. 
    
    Find-Water
    For each point in non-sampled, if elevation is zero, move to water set. 
    
    Find-Island: 
    Select a point from non-sampled points, this will be part of a unique island.  
    Remove this point from non-sampled points 
    Add this point to temporary-set of island-points 
    For each adjacent location, do Extend-Island(point, island-points)
    
    Extend-Island(point, island-points): 
    If point is in non-sampled points Then
      Remove point from non-sampled points
      Add point to island-points
      For Each adjacent location, do Extend-Island(point, island-points)
    Endif
    Cheers,
    Oralloy

    Comment

    Working...