cc-routing / routing-sara

Seznam Advanced Routing Algorithm
1 stars 2 forks source link

Consider only the largest connected component #18

Closed blahami2 closed 8 years ago

blahami2 commented 8 years ago
component := 1
foreach node u where u.visited = false
    foreach node n in DFS(u)
         n.visited = true
         n.component := component
    component := component + 1
max_component = component_map.getall.max(::Size)
foreach node u where u.component != max_component
    remove u from graph
    remove u.edges from graph
blahami2 commented 8 years ago

Use

GraphDataUpdater dataUpdater = new SqliteGraphDataUpdater( properties );
GraphDeleteMessenger isolatedAreas = new GraphComponentSearcher().findAllButLargest( graph );
dataUpdater.deleteIsolatedAreas( isolatedAreas );