Skip to content

Graph generation: label simplification on borders #93

Closed

Description

@jteresco

Idea for a new label simplification: allow reversed border labels to match.

DE491@DE/PA&PA491@PA/DE

would become

DE491/PA491@PA/DE

Could do similar things when states/provinces/countries are mixed rather than matched at a border.

Activity

  1. yakra commented on Feb 2, 2019

    @yakra
    Contributor

    NB2@QC/NB&TCHMai@QC/NB&A-85Not@NB/QC&TCHMai@QC/NB

  2. yakra commented on Apr 26, 2019

    @yakra
    Contributor

    US12@IL/IN&US20@IL/IN&US41@IN/IL&US12@IL/IN&US20@IL/IN&US41@IN/IL
    would become
    US12/US20/US41@IL/IN

    Ooh, here's a good one...
    AP1@ESP/FRA&AP8@FRA/ESP&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA&A63@ESP/FRA&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA&A63@ESP/FRA&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA
    if not for the France split-up in progress, would be
    AP1@ESP/FRA&AP8@FRA/ESP&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA&A63@ESP/FRA&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA
    or similar, and would become
    AP1/AP8/A63/A63/E5/E70/E80@ESP/FRA
    A63/AP1/AP8/E5/E70/E80@ESP/FRA
    Or in actuality AP1/AP8/E5/E70/E80/A63@ESP/FRA, as the waypoints were sorted by "root@label", and the roots contain the split ESP & FRA subregions.

  3. yakra commented on Nov 7, 2019

    @yakra
    Contributor

    HighwayData @ 3405ad2362d9761e95f0e0936fefbe037eadca16

    yakra@BiggaTomato:~/TravelMapping/yakra/DataProcessing/siteupdate/cplusplus/logs$ cat waypointsimplification.log | grep 'Keep failsafe: ' | grep '.\+@.\+/.\+&.\+@.\+/.\+' | wc -l
    1258
    
  4. yakra commented on Nov 7, 2019

    @yakra
    Contributor

    Lol, took longer to write this than it would have to just implement the darn thing!

    labels=`cat waypointsimplification.log | grep 'Keep failsafe: ' | sed 's/Keep failsafe: \(.*\)/\1/' | grep '.*@.*/.*&.*@.*/.*'`
    for label in $labels; do
      points=`echo $label | tr '&' ' '`
      count=`echo $points | wc -w`
      CanonicalBoundary=`echo $points | sed 's/.*@\(.*\)$/\1/'`
      matches=0
      routes=""
      for point in $points; do
        route=`echo $point | cut -f1 -d@`
        routes=`echo $routes $route`
        boundary=`echo $point | cut -f2 -d@`
        foo=`echo $boundary | cut -f1 -d/`
        bar=`echo $boundary | cut -f2 -d/`
        if [ "$foo/$bar" == $CanonicalBoundary ] || [ "$bar/$foo" == $CanonicalBoundary ]; then
          matches=`expr $matches + 1`
        fi
      done
      if [ $matches == $count ]; then
        echo -en "$count\t$label\t->\t"
        routes=`for route in $routes; do echo $route; done | sort | uniq`
        echo -n $routes | tr ' ' '/'
        echo "@$CanonicalBoundary"
      fi
    done

    Cleans things up rather nicely. Captures 615 cases.
    The seven examples with the most routes involved, and what they boil down to:

    failsafe shortened
    E61@SVN/ITA&E70@ITA/SVN&RA14@ITA/SVN&SS58@ITA/SVN&A3@SVN/ITA&E61@SVN/ITA&E70@ITA/SVN A3/E61/E70/RA14/SS58@ITA/SVN
    A1@CHE/FRA&E25@CHE/FRA&E62@FRA/CHE&A41@FRA/CHE&E21@FRA/CHE&E25@CHE/FRA&E62Bou@FRA/CHE A1/A41/E21/E25/E62/E62Bou@FRA/CHE
    AH5@KAZ/KGZ&AH61@KGZ/KAZ&E125@KAZ/KGZ&E40@KGZ/KAZ&AH5@KAZ/KGZ&AH61@KGZ/KAZ&E125@KAZ/KGZ&E40@KGZ/KAZ&EM01@KGZ/KAZ AH5/AH61/E125/E40/EM01@KGZ/KAZ
    AH5Shy@KGZ/KAZ&AH7@KAZ/KGZ&E40Shy@KAZ/KGZ&AH5@KGZ/KAZ&AH7@KAZ/KGZ&E40@KAZ/KGZ&EM01@KAZ/KGZ AH5/AH5Shy/AH7/E40/E40Shy/EM01@KAZ/KGZ
    A2@KAZ/UZB&AH5Shy@KAZ/UZB&AH62@KAZ/UZB&E123@KAZ/UZB&E40Shy@UZB/KAZ&AH5@KAZ/UZB&AH62@KAZ/UZB&E123@KAZ/UZB&E40@UZB/KAZ&M39@KAZ/UZB A2/AH5/AH5Shy/AH62/E123/E40/E40Shy/M39@KAZ/UZB
    AP1@ESP/FRA&AP8@FRA/ESP&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA&A63@ESP/FRA&E5@FRA/ESP&E70@ESP/FRA&E80@ESP/FRA A63/AP1/AP8/E5/E70/E80@ESP/FRA
    I-55@TN/AR&US61@TN/AR&US64@AR/TN&US70@AR/TN&US79@AR/TN&I-55@TN/AR&US61@TN/AR&US64@AR/TN&US70@AR/TN&US79@AR/TN I-55/US61/US64/US70/US79@AR/TN
  5. self-assigned this
    on Nov 19, 2019
  6. added a commit that references this issue on Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions