Skip to content

Instantly share code, notes, and snippets.

@jamesfe
Created July 12, 2016 14:57
Show Gist options
  • Select an option

  • Save jamesfe/0560ab709bbc7b4f9966efef2e96a131 to your computer and use it in GitHub Desktop.

Select an option

Save jamesfe/0560ab709bbc7b4f9966efef2e96a131 to your computer and use it in GitHub Desktop.
Metro Network
{
"nodes": [
{
"line": "RD",
"name": "Shady Grove - RD",
"unique_id": "RDA15"
},
{
"line": "RD",
"name": "Rockville - RD",
"unique_id": "RDA14"
},
{
"line": "RD",
"name": "Twinbrook - RD",
"unique_id": "RDA13"
},
{
"line": "RD",
"name": "White Flint - RD",
"unique_id": "RDA12"
},
{
"line": "RD",
"name": "Grosvenor-Strathmore - RD",
"unique_id": "RDA11"
},
{
"line": "RD",
"name": "Medical Center - RD",
"unique_id": "RDA10"
},
{
"line": "RD",
"name": "Bethesda - RD",
"unique_id": "RDA09"
},
{
"line": "RD",
"name": "Friendship Heights - RD",
"unique_id": "RDA08"
},
{
"line": "RD",
"name": "Tenleytown-AU - RD",
"unique_id": "RDA07"
},
{
"line": "RD",
"name": "Van Ness-UDC - RD",
"unique_id": "RDA06"
},
{
"line": "RD",
"name": "Cleveland Park - RD",
"unique_id": "RDA05"
},
{
"line": "RD",
"name": "Woodley Park-Zoo/Adams Morgan - RD",
"unique_id": "RDA04"
},
{
"line": "RD",
"name": "Dupont Circle - RD",
"unique_id": "RDA03"
},
{
"line": "RD",
"name": "Farragut North - RD",
"unique_id": "RDA02"
},
{
"line": "RD",
"name": "Metro Center - RD",
"unique_id": "RDA01"
},
{
"line": "RD",
"name": "Gallery Pl-Chinatown - RD",
"unique_id": "RDB01"
},
{
"line": "RD",
"name": "Judiciary Square - RD",
"unique_id": "RDB02"
},
{
"line": "RD",
"name": "Union Station - RD",
"unique_id": "RDB03"
},
{
"line": "RD",
"name": "NoMa-Gallaudet U - RD",
"unique_id": "RDB35"
},
{
"line": "RD",
"name": "Rhode Island Ave-Brentwood - RD",
"unique_id": "RDB04"
},
{
"line": "RD",
"name": "Brookland-CUA - RD",
"unique_id": "RDB05"
},
{
"line": "RD",
"name": "Fort Totten - RD",
"unique_id": "RDB06"
},
{
"line": "RD",
"name": "Takoma - RD",
"unique_id": "RDB07"
},
{
"line": "RD",
"name": "Silver Spring - RD",
"unique_id": "RDB08"
},
{
"line": "RD",
"name": "Forest Glen - RD",
"unique_id": "RDB09"
},
{
"line": "RD",
"name": "Wheaton - RD",
"unique_id": "RDB10"
},
{
"line": "RD",
"name": "Glenmont - RD",
"unique_id": "RDB11"
},
{
"line": "BL",
"name": "Largo Town Center - BL",
"unique_id": "BLG05"
},
{
"line": "BL",
"name": "Morgan Boulevard - BL",
"unique_id": "BLG04"
},
{
"line": "BL",
"name": "Addison Road-Seat Pleasant - BL",
"unique_id": "BLG03"
},
{
"line": "BL",
"name": "Capitol Heights - BL",
"unique_id": "BLG02"
},
{
"line": "BL",
"name": "Benning Road - BL",
"unique_id": "BLG01"
},
{
"line": "BL",
"name": "Stadium-Armory - BL",
"unique_id": "BLD08"
},
{
"line": "BL",
"name": "Potomac Ave - BL",
"unique_id": "BLD07"
},
{
"line": "BL",
"name": "Eastern Market - BL",
"unique_id": "BLD06"
},
{
"line": "BL",
"name": "Capitol South - BL",
"unique_id": "BLD05"
},
{
"line": "BL",
"name": "Federal Center SW - BL",
"unique_id": "BLD04"
},
{
"line": "BL",
"name": "L'Enfant Plaza - BL",
"unique_id": "BLD03"
},
{
"line": "BL",
"name": "Smithsonian - BL",
"unique_id": "BLD02"
},
{
"line": "BL",
"name": "Federal Triangle - BL",
"unique_id": "BLD01"
},
{
"line": "BL",
"name": "Metro Center - BL",
"unique_id": "BLC01"
},
{
"line": "BL",
"name": "McPherson Square - BL",
"unique_id": "BLC02"
},
{
"line": "BL",
"name": "Farragut West - BL",
"unique_id": "BLC03"
},
{
"line": "BL",
"name": "Foggy Bottom-GWU - BL",
"unique_id": "BLC04"
},
{
"line": "BL",
"name": "Rosslyn - BL",
"unique_id": "BLC05"
},
{
"line": "BL",
"name": "Arlington Cemetery - BL",
"unique_id": "BLC06"
},
{
"line": "BL",
"name": "Pentagon - BL",
"unique_id": "BLC07"
},
{
"line": "BL",
"name": "Pentagon City - BL",
"unique_id": "BLC08"
},
{
"line": "BL",
"name": "Crystal City - BL",
"unique_id": "BLC09"
},
{
"line": "BL",
"name": "Ronald Reagan Washington National Airport - BL",
"unique_id": "BLC10"
},
{
"line": "BL",
"name": "Braddock Road - BL",
"unique_id": "BLC12"
},
{
"line": "BL",
"name": "King St-Old Town - BL",
"unique_id": "BLC13"
},
{
"line": "BL",
"name": "Van Dorn Street - BL",
"unique_id": "BLJ02"
},
{
"line": "BL",
"name": "Franconia-Springfield - BL",
"unique_id": "BLJ03"
},
{
"line": "YL",
"name": "Huntington - YL",
"unique_id": "YLC15"
},
{
"line": "YL",
"name": "Eisenhower Avenue - YL",
"unique_id": "YLC14"
},
{
"line": "YL",
"name": "King St-Old Town - YL",
"unique_id": "YLC13"
},
{
"line": "YL",
"name": "Braddock Road - YL",
"unique_id": "YLC12"
},
{
"line": "YL",
"name": "Ronald Reagan Washington National Airport - YL",
"unique_id": "YLC10"
},
{
"line": "YL",
"name": "Crystal City - YL",
"unique_id": "YLC09"
},
{
"line": "YL",
"name": "Pentagon City - YL",
"unique_id": "YLC08"
},
{
"line": "YL",
"name": "Pentagon - YL",
"unique_id": "YLC07"
},
{
"line": "YL",
"name": "L'Enfant Plaza - YL",
"unique_id": "YLF03"
},
{
"line": "YL",
"name": "Archives-Navy Memorial-Penn Quarter - YL",
"unique_id": "YLF02"
},
{
"line": "YL",
"name": "Gallery Pl-Chinatown - YL",
"unique_id": "YLF01"
},
{
"line": "YL",
"name": "Mt Vernon Sq 7th St-Convention Center - YL",
"unique_id": "YLE01"
},
{
"line": "YL",
"name": "Shaw-Howard U - YL",
"unique_id": "YLE02"
},
{
"line": "YL",
"name": "U Street/African-Amer Civil War Memorial/Cardozo - YL",
"unique_id": "YLE03"
},
{
"line": "YL",
"name": "Columbia Heights - YL",
"unique_id": "YLE04"
},
{
"line": "YL",
"name": "Georgia Ave-Petworth - YL",
"unique_id": "YLE05"
},
{
"line": "YL",
"name": "Fort Totten - YL",
"unique_id": "YLE06"
},
{
"line": "OR",
"name": "New Carrollton - OR",
"unique_id": "ORD13"
},
{
"line": "OR",
"name": "Landover - OR",
"unique_id": "ORD12"
},
{
"line": "OR",
"name": "Cheverly - OR",
"unique_id": "ORD11"
},
{
"line": "OR",
"name": "Deanwood - OR",
"unique_id": "ORD10"
},
{
"line": "OR",
"name": "Minnesota Ave - OR",
"unique_id": "ORD09"
},
{
"line": "OR",
"name": "Stadium-Armory - OR",
"unique_id": "ORD08"
},
{
"line": "OR",
"name": "Potomac Ave - OR",
"unique_id": "ORD07"
},
{
"line": "OR",
"name": "Eastern Market - OR",
"unique_id": "ORD06"
},
{
"line": "OR",
"name": "Capitol South - OR",
"unique_id": "ORD05"
},
{
"line": "OR",
"name": "Federal Center SW - OR",
"unique_id": "ORD04"
},
{
"line": "OR",
"name": "L'Enfant Plaza - OR",
"unique_id": "ORD03"
},
{
"line": "OR",
"name": "Smithsonian - OR",
"unique_id": "ORD02"
},
{
"line": "OR",
"name": "Federal Triangle - OR",
"unique_id": "ORD01"
},
{
"line": "OR",
"name": "Metro Center - OR",
"unique_id": "ORC01"
},
{
"line": "OR",
"name": "McPherson Square - OR",
"unique_id": "ORC02"
},
{
"line": "OR",
"name": "Farragut West - OR",
"unique_id": "ORC03"
},
{
"line": "OR",
"name": "Foggy Bottom-GWU - OR",
"unique_id": "ORC04"
},
{
"line": "OR",
"name": "Rosslyn - OR",
"unique_id": "ORC05"
},
{
"line": "OR",
"name": "Court House - OR",
"unique_id": "ORK01"
},
{
"line": "OR",
"name": "Clarendon - OR",
"unique_id": "ORK02"
},
{
"line": "OR",
"name": "Virginia Square-GMU - OR",
"unique_id": "ORK03"
},
{
"line": "OR",
"name": "Ballston-MU - OR",
"unique_id": "ORK04"
},
{
"line": "OR",
"name": "East Falls Church - OR",
"unique_id": "ORK05"
},
{
"line": "OR",
"name": "West Falls Church-VT/UVA - OR",
"unique_id": "ORK06"
},
{
"line": "OR",
"name": "Dunn Loring-Merrifield - OR",
"unique_id": "ORK07"
},
{
"line": "OR",
"name": "Vienna/Fairfax-GMU - OR",
"unique_id": "ORK08"
},
{
"line": "GR",
"name": "Branch Ave - GR",
"unique_id": "GRF11"
},
{
"line": "GR",
"name": "Suitland - GR",
"unique_id": "GRF10"
},
{
"line": "GR",
"name": "Naylor Road - GR",
"unique_id": "GRF09"
},
{
"line": "GR",
"name": "Southern Avenue - GR",
"unique_id": "GRF08"
},
{
"line": "GR",
"name": "Congress Heights - GR",
"unique_id": "GRF07"
},
{
"line": "GR",
"name": "Anacostia - GR",
"unique_id": "GRF06"
},
{
"line": "GR",
"name": "Navy Yard-Ballpark - GR",
"unique_id": "GRF05"
},
{
"line": "GR",
"name": "Waterfront - GR",
"unique_id": "GRF04"
},
{
"line": "GR",
"name": "L'Enfant Plaza - GR",
"unique_id": "GRF03"
},
{
"line": "GR",
"name": "Archives-Navy Memorial-Penn Quarter - GR",
"unique_id": "GRF02"
},
{
"line": "GR",
"name": "Gallery Pl-Chinatown - GR",
"unique_id": "GRF01"
},
{
"line": "GR",
"name": "Mt Vernon Sq 7th St-Convention Center - GR",
"unique_id": "GRE01"
},
{
"line": "GR",
"name": "Shaw-Howard U - GR",
"unique_id": "GRE02"
},
{
"line": "GR",
"name": "U Street/African-Amer Civil War Memorial/Cardozo - GR",
"unique_id": "GRE03"
},
{
"line": "GR",
"name": "Columbia Heights - GR",
"unique_id": "GRE04"
},
{
"line": "GR",
"name": "Georgia Ave-Petworth - GR",
"unique_id": "GRE05"
},
{
"line": "GR",
"name": "Fort Totten - GR",
"unique_id": "GRE06"
},
{
"line": "GR",
"name": "West Hyattsville - GR",
"unique_id": "GRE07"
},
{
"line": "GR",
"name": "Prince George's Plaza - GR",
"unique_id": "GRE08"
},
{
"line": "GR",
"name": "College Park-U of MD - GR",
"unique_id": "GRE09"
},
{
"line": "GR",
"name": "Greenbelt - GR",
"unique_id": "GRE10"
},
{
"line": "SV",
"name": "Largo Town Center - SV",
"unique_id": "SVG05"
},
{
"line": "SV",
"name": "Morgan Boulevard - SV",
"unique_id": "SVG04"
},
{
"line": "SV",
"name": "Addison Road-Seat Pleasant - SV",
"unique_id": "SVG03"
},
{
"line": "SV",
"name": "Capitol Heights - SV",
"unique_id": "SVG02"
},
{
"line": "SV",
"name": "Benning Road - SV",
"unique_id": "SVG01"
},
{
"line": "SV",
"name": "Stadium-Armory - SV",
"unique_id": "SVD08"
},
{
"line": "SV",
"name": "Potomac Ave - SV",
"unique_id": "SVD07"
},
{
"line": "SV",
"name": "Eastern Market - SV",
"unique_id": "SVD06"
},
{
"line": "SV",
"name": "Capitol South - SV",
"unique_id": "SVD05"
},
{
"line": "SV",
"name": "Federal Center SW - SV",
"unique_id": "SVD04"
},
{
"line": "SV",
"name": "L'Enfant Plaza - SV",
"unique_id": "SVD03"
},
{
"line": "SV",
"name": "Smithsonian - SV",
"unique_id": "SVD02"
},
{
"line": "SV",
"name": "Federal Triangle - SV",
"unique_id": "SVD01"
},
{
"line": "SV",
"name": "Metro Center - SV",
"unique_id": "SVC01"
},
{
"line": "SV",
"name": "McPherson Square - SV",
"unique_id": "SVC02"
},
{
"line": "SV",
"name": "Farragut West - SV",
"unique_id": "SVC03"
},
{
"line": "SV",
"name": "Foggy Bottom-GWU - SV",
"unique_id": "SVC04"
},
{
"line": "SV",
"name": "Rosslyn - SV",
"unique_id": "SVC05"
},
{
"line": "SV",
"name": "Court House - SV",
"unique_id": "SVK01"
},
{
"line": "SV",
"name": "Clarendon - SV",
"unique_id": "SVK02"
},
{
"line": "SV",
"name": "Virginia Square-GMU - SV",
"unique_id": "SVK03"
},
{
"line": "SV",
"name": "Ballston-MU - SV",
"unique_id": "SVK04"
},
{
"line": "SV",
"name": "East Falls Church - SV",
"unique_id": "SVK05"
},
{
"line": "SV",
"name": "McLean - SV",
"unique_id": "SVN01"
},
{
"line": "SV",
"name": "Tysons Corner - SV",
"unique_id": "SVN02"
},
{
"line": "SV",
"name": "Greensboro - SV",
"unique_id": "SVN03"
},
{
"line": "SV",
"name": "Spring Hill - SV",
"unique_id": "SVN04"
},
{
"line": "SV",
"name": "Wiehle-Reston East - SV",
"unique_id": "SVN06"
}
],
"links": [
{
"start": "RDA15",
"end": "RDA14",
"distance": 100
},
{
"start": "RDA14",
"end": "RDA13",
"distance": 100
},
{
"start": "RDA13",
"end": "RDA12",
"distance": 100
},
{
"start": "RDA12",
"end": "RDA11",
"distance": 100
},
{
"start": "RDA11",
"end": "RDA10",
"distance": 100
},
{
"start": "RDA10",
"end": "RDA09",
"distance": 100
},
{
"start": "RDA09",
"end": "RDA08",
"distance": 100
},
{
"start": "RDA08",
"end": "RDA07",
"distance": 100
},
{
"start": "RDA07",
"end": "RDA06",
"distance": 100
},
{
"start": "RDA06",
"end": "RDA05",
"distance": 100
},
{
"start": "RDA05",
"end": "RDA04",
"distance": 100
},
{
"start": "RDA04",
"end": "RDA03",
"distance": 100
},
{
"start": "RDA03",
"end": "RDA02",
"distance": 100
},
{
"start": "RDA02",
"end": "RDA01",
"distance": 100
},
{
"start": "RDA01",
"end": "RDB01",
"distance": 100
},
{
"start": "RDB01",
"end": "RDB02",
"distance": 100
},
{
"start": "RDB02",
"end": "RDB03",
"distance": 100
},
{
"start": "RDB03",
"end": "RDB35",
"distance": 100
},
{
"start": "RDB35",
"end": "RDB04",
"distance": 100
},
{
"start": "RDB04",
"end": "RDB05",
"distance": 100
},
{
"start": "RDB05",
"end": "RDB06",
"distance": 100
},
{
"start": "RDB06",
"end": "RDB07",
"distance": 100
},
{
"start": "RDB07",
"end": "RDB08",
"distance": 100
},
{
"start": "RDB08",
"end": "RDB09",
"distance": 100
},
{
"start": "RDB09",
"end": "RDB10",
"distance": 100
},
{
"start": "RDB10",
"end": "RDB11",
"distance": 100
},
{
"start": "BLG05",
"end": "BLG04",
"distance": 100
},
{
"start": "BLG04",
"end": "BLG03",
"distance": 100
},
{
"start": "BLG03",
"end": "BLG02",
"distance": 100
},
{
"start": "BLG02",
"end": "BLG01",
"distance": 100
},
{
"start": "BLG01",
"end": "BLD08",
"distance": 100
},
{
"start": "BLD08",
"end": "BLD07",
"distance": 100
},
{
"start": "BLD07",
"end": "BLD06",
"distance": 100
},
{
"start": "BLD06",
"end": "BLD05",
"distance": 100
},
{
"start": "BLD05",
"end": "BLD04",
"distance": 100
},
{
"start": "BLD04",
"end": "BLD03",
"distance": 100
},
{
"start": "BLD03",
"end": "BLD02",
"distance": 100
},
{
"start": "BLD02",
"end": "BLD01",
"distance": 100
},
{
"start": "BLD01",
"end": "BLC01",
"distance": 100
},
{
"start": "BLC01",
"end": "BLC02",
"distance": 100
},
{
"start": "BLC02",
"end": "BLC03",
"distance": 100
},
{
"start": "BLC03",
"end": "BLC04",
"distance": 100
},
{
"start": "BLC04",
"end": "BLC05",
"distance": 100
},
{
"start": "BLC05",
"end": "BLC06",
"distance": 100
},
{
"start": "BLC06",
"end": "BLC07",
"distance": 100
},
{
"start": "BLC07",
"end": "BLC08",
"distance": 100
},
{
"start": "BLC08",
"end": "BLC09",
"distance": 100
},
{
"start": "BLC09",
"end": "BLC10",
"distance": 100
},
{
"start": "BLC10",
"end": "BLC12",
"distance": 100
},
{
"start": "BLC12",
"end": "BLC13",
"distance": 100
},
{
"start": "BLC13",
"end": "BLJ02",
"distance": 100
},
{
"start": "BLJ02",
"end": "BLJ03",
"distance": 100
},
{
"start": "YLC15",
"end": "YLC14",
"distance": 100
},
{
"start": "YLC14",
"end": "YLC13",
"distance": 100
},
{
"start": "YLC13",
"end": "YLC12",
"distance": 100
},
{
"start": "YLC12",
"end": "YLC10",
"distance": 100
},
{
"start": "YLC10",
"end": "YLC09",
"distance": 100
},
{
"start": "YLC09",
"end": "YLC08",
"distance": 100
},
{
"start": "YLC08",
"end": "YLC07",
"distance": 100
},
{
"start": "YLC07",
"end": "YLF03",
"distance": 100
},
{
"start": "YLF03",
"end": "YLF02",
"distance": 100
},
{
"start": "YLF02",
"end": "YLF01",
"distance": 100
},
{
"start": "YLF01",
"end": "YLE01",
"distance": 100
},
{
"start": "YLE01",
"end": "YLE02",
"distance": 100
},
{
"start": "YLE02",
"end": "YLE03",
"distance": 100
},
{
"start": "YLE03",
"end": "YLE04",
"distance": 100
},
{
"start": "YLE04",
"end": "YLE05",
"distance": 100
},
{
"start": "YLE05",
"end": "YLE06",
"distance": 100
},
{
"start": "ORD13",
"end": "ORD12",
"distance": 100
},
{
"start": "ORD12",
"end": "ORD11",
"distance": 100
},
{
"start": "ORD11",
"end": "ORD10",
"distance": 100
},
{
"start": "ORD10",
"end": "ORD09",
"distance": 100
},
{
"start": "ORD09",
"end": "ORD08",
"distance": 100
},
{
"start": "ORD08",
"end": "ORD07",
"distance": 100
},
{
"start": "ORD07",
"end": "ORD06",
"distance": 100
},
{
"start": "ORD06",
"end": "ORD05",
"distance": 100
},
{
"start": "ORD05",
"end": "ORD04",
"distance": 100
},
{
"start": "ORD04",
"end": "ORD03",
"distance": 100
},
{
"start": "ORD03",
"end": "ORD02",
"distance": 100
},
{
"start": "ORD02",
"end": "ORD01",
"distance": 100
},
{
"start": "ORD01",
"end": "ORC01",
"distance": 100
},
{
"start": "ORC01",
"end": "ORC02",
"distance": 100
},
{
"start": "ORC02",
"end": "ORC03",
"distance": 100
},
{
"start": "ORC03",
"end": "ORC04",
"distance": 100
},
{
"start": "ORC04",
"end": "ORC05",
"distance": 100
},
{
"start": "ORC05",
"end": "ORK01",
"distance": 100
},
{
"start": "ORK01",
"end": "ORK02",
"distance": 100
},
{
"start": "ORK02",
"end": "ORK03",
"distance": 100
},
{
"start": "ORK03",
"end": "ORK04",
"distance": 100
},
{
"start": "ORK04",
"end": "ORK05",
"distance": 100
},
{
"start": "ORK05",
"end": "ORK06",
"distance": 100
},
{
"start": "ORK06",
"end": "ORK07",
"distance": 100
},
{
"start": "ORK07",
"end": "ORK08",
"distance": 100
},
{
"start": "GRF11",
"end": "GRF10",
"distance": 100
},
{
"start": "GRF10",
"end": "GRF09",
"distance": 100
},
{
"start": "GRF09",
"end": "GRF08",
"distance": 100
},
{
"start": "GRF08",
"end": "GRF07",
"distance": 100
},
{
"start": "GRF07",
"end": "GRF06",
"distance": 100
},
{
"start": "GRF06",
"end": "GRF05",
"distance": 100
},
{
"start": "GRF05",
"end": "GRF04",
"distance": 100
},
{
"start": "GRF04",
"end": "GRF03",
"distance": 100
},
{
"start": "GRF03",
"end": "GRF02",
"distance": 100
},
{
"start": "GRF02",
"end": "GRF01",
"distance": 100
},
{
"start": "GRF01",
"end": "GRE01",
"distance": 100
},
{
"start": "GRE01",
"end": "GRE02",
"distance": 100
},
{
"start": "GRE02",
"end": "GRE03",
"distance": 100
},
{
"start": "GRE03",
"end": "GRE04",
"distance": 100
},
{
"start": "GRE04",
"end": "GRE05",
"distance": 100
},
{
"start": "GRE05",
"end": "GRE06",
"distance": 100
},
{
"start": "GRE06",
"end": "GRE07",
"distance": 100
},
{
"start": "GRE07",
"end": "GRE08",
"distance": 100
},
{
"start": "GRE08",
"end": "GRE09",
"distance": 100
},
{
"start": "GRE09",
"end": "GRE10",
"distance": 100
},
{
"start": "SVG05",
"end": "SVG04",
"distance": 100
},
{
"start": "SVG04",
"end": "SVG03",
"distance": 100
},
{
"start": "SVG03",
"end": "SVG02",
"distance": 100
},
{
"start": "SVG02",
"end": "SVG01",
"distance": 100
},
{
"start": "SVG01",
"end": "SVD08",
"distance": 100
},
{
"start": "SVD08",
"end": "SVD07",
"distance": 100
},
{
"start": "SVD07",
"end": "SVD06",
"distance": 100
},
{
"start": "SVD06",
"end": "SVD05",
"distance": 100
},
{
"start": "SVD05",
"end": "SVD04",
"distance": 100
},
{
"start": "SVD04",
"end": "SVD03",
"distance": 100
},
{
"start": "SVD03",
"end": "SVD02",
"distance": 100
},
{
"start": "SVD02",
"end": "SVD01",
"distance": 100
},
{
"start": "SVD01",
"end": "SVC01",
"distance": 100
},
{
"start": "SVC01",
"end": "SVC02",
"distance": 100
},
{
"start": "SVC02",
"end": "SVC03",
"distance": 100
},
{
"start": "SVC03",
"end": "SVC04",
"distance": 100
},
{
"start": "SVC04",
"end": "SVC05",
"distance": 100
},
{
"start": "SVC05",
"end": "SVK01",
"distance": 100
},
{
"start": "SVK01",
"end": "SVK02",
"distance": 100
},
{
"start": "SVK02",
"end": "SVK03",
"distance": 100
},
{
"start": "SVK03",
"end": "SVK04",
"distance": 100
},
{
"start": "SVK04",
"end": "SVK05",
"distance": 100
},
{
"start": "SVK05",
"end": "SVN01",
"distance": 100
},
{
"start": "SVN01",
"end": "SVN02",
"distance": 100
},
{
"start": "SVN02",
"end": "SVN03",
"distance": 100
},
{
"start": "SVN03",
"end": "SVN04",
"distance": 100
},
{
"start": "SVN04",
"end": "SVN06",
"distance": 100
},
{
"start": "RDA02",
"end": "BLC03",
"distance": 2
},
{
"start": "RDA02",
"end": "ORC03",
"distance": 2
},
{
"start": "RDA02",
"end": "SVC03",
"distance": 2
},
{
"start": "RDA01",
"end": "BLC01",
"distance": 2
},
{
"start": "RDA01",
"end": "ORC01",
"distance": 2
},
{
"start": "RDA01",
"end": "SVC01",
"distance": 2
},
{
"start": "RDB01",
"end": "YLF01",
"distance": 2
},
{
"start": "RDB01",
"end": "GRF01",
"distance": 2
},
{
"start": "RDB06",
"end": "YLE06",
"distance": 2
},
{
"start": "RDB06",
"end": "GRE06",
"distance": 2
},
{
"start": "BLG05",
"end": "SVG05",
"distance": 1
},
{
"start": "BLG04",
"end": "SVG04",
"distance": 1
},
{
"start": "BLG03",
"end": "SVG03",
"distance": 1
},
{
"start": "BLG02",
"end": "SVG02",
"distance": 1
},
{
"start": "BLG01",
"end": "SVG01",
"distance": 1
},
{
"start": "BLD08",
"end": "ORD08",
"distance": 1
},
{
"start": "BLD08",
"end": "SVD08",
"distance": 1
},
{
"start": "BLD07",
"end": "ORD07",
"distance": 1
},
{
"start": "BLD07",
"end": "SVD07",
"distance": 1
},
{
"start": "BLD06",
"end": "ORD06",
"distance": 1
},
{
"start": "BLD06",
"end": "SVD06",
"distance": 1
},
{
"start": "BLD05",
"end": "ORD05",
"distance": 1
},
{
"start": "BLD05",
"end": "SVD05",
"distance": 1
},
{
"start": "BLD04",
"end": "ORD04",
"distance": 1
},
{
"start": "BLD04",
"end": "SVD04",
"distance": 1
},
{
"start": "BLD03",
"end": "YLF03",
"distance": 2
},
{
"start": "BLD03",
"end": "ORD03",
"distance": 1
},
{
"start": "BLD03",
"end": "GRF03",
"distance": 2
},
{
"start": "BLD03",
"end": "SVD03",
"distance": 1
},
{
"start": "BLD02",
"end": "ORD02",
"distance": 1
},
{
"start": "BLD02",
"end": "SVD02",
"distance": 1
},
{
"start": "BLD01",
"end": "ORD01",
"distance": 1
},
{
"start": "BLD01",
"end": "SVD01",
"distance": 1
},
{
"start": "BLC01",
"end": "ORC01",
"distance": 1
},
{
"start": "BLC01",
"end": "SVC01",
"distance": 1
},
{
"start": "BLC02",
"end": "ORC02",
"distance": 1
},
{
"start": "BLC02",
"end": "SVC02",
"distance": 1
},
{
"start": "BLC03",
"end": "ORC03",
"distance": 1
},
{
"start": "BLC03",
"end": "SVC03",
"distance": 1
},
{
"start": "BLC04",
"end": "ORC04",
"distance": 1
},
{
"start": "BLC04",
"end": "SVC04",
"distance": 1
},
{
"start": "BLC05",
"end": "ORC05",
"distance": 1
},
{
"start": "BLC05",
"end": "SVC05",
"distance": 1
},
{
"start": "BLC07",
"end": "YLC07",
"distance": 1
},
{
"start": "BLC08",
"end": "YLC08",
"distance": 1
},
{
"start": "BLC09",
"end": "YLC09",
"distance": 1
},
{
"start": "BLC10",
"end": "YLC10",
"distance": 1
},
{
"start": "BLC12",
"end": "YLC12",
"distance": 1
},
{
"start": "BLC13",
"end": "YLC13",
"distance": 1
},
{
"start": "YLF03",
"end": "ORD03",
"distance": 2
},
{
"start": "YLF03",
"end": "GRF03",
"distance": 1
},
{
"start": "YLF03",
"end": "SVD03",
"distance": 2
},
{
"start": "YLF02",
"end": "GRF02",
"distance": 1
},
{
"start": "YLF01",
"end": "GRF01",
"distance": 1
},
{
"start": "YLE01",
"end": "GRE01",
"distance": 1
},
{
"start": "YLE02",
"end": "GRE02",
"distance": 1
},
{
"start": "YLE03",
"end": "GRE03",
"distance": 1
},
{
"start": "YLE04",
"end": "GRE04",
"distance": 1
},
{
"start": "YLE05",
"end": "GRE05",
"distance": 1
},
{
"start": "YLE06",
"end": "GRE06",
"distance": 1
},
{
"start": "ORD08",
"end": "SVD08",
"distance": 1
},
{
"start": "ORD07",
"end": "SVD07",
"distance": 1
},
{
"start": "ORD06",
"end": "SVD06",
"distance": 1
},
{
"start": "ORD05",
"end": "SVD05",
"distance": 1
},
{
"start": "ORD04",
"end": "SVD04",
"distance": 1
},
{
"start": "ORD03",
"end": "GRF03",
"distance": 2
},
{
"start": "ORD03",
"end": "SVD03",
"distance": 1
},
{
"start": "ORD02",
"end": "SVD02",
"distance": 1
},
{
"start": "ORD01",
"end": "SVD01",
"distance": 1
},
{
"start": "ORC01",
"end": "SVC01",
"distance": 1
},
{
"start": "ORC02",
"end": "SVC02",
"distance": 1
},
{
"start": "ORC03",
"end": "SVC03",
"distance": 1
},
{
"start": "ORC04",
"end": "SVC04",
"distance": 1
},
{
"start": "ORC05",
"end": "SVC05",
"distance": 1
},
{
"start": "ORK01",
"end": "SVK01",
"distance": 1
},
{
"start": "ORK02",
"end": "SVK02",
"distance": 1
},
{
"start": "ORK03",
"end": "SVK03",
"distance": 1
},
{
"start": "ORK04",
"end": "SVK04",
"distance": 1
},
{
"start": "ORK05",
"end": "SVK05",
"distance": 1
},
{
"start": "GRF03",
"end": "SVD03",
"distance": 2
}
]
}
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke-width: 1.5px;
}
.link {
stroke: #999;
stroke-opacity: .6;
}
.smtext {
font-family: Verdana, Arial, sans-serif;
font-weight: lighter;
font-size: 10px;
stroke-width: 0.1px;
stroke: #000;
}
</style>
<body>
<script src="http:////d3js.org/d3.v3.min.js"></script>
<!-- <script src="./lib/d3.v3.min.js"></script> -->
<script src="./network.js"></script>
var width = 1200,
height = 700;
// var color = d3.scale.category20();
var color = {
'RD': '#bd1338',
'YL': '#f5d018',
'BL': '#0b94d4',
'OR': '#de8704',
'SV': '#9fa19f',
'GR': '#00b04f'
};
var force = d3.layout.force()
.charge(-120)
.linkDistance(30)
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("data_network.json", function(error, data) {
if (error) throw error;
group_nodes = data.nodes.map(function (item) {
item.group = 1;
return item;
});
function getIndex(list, unique_id) {
for(var i = 0; i < list.length; i++) {
if (list[i].unique_id === unique_id) {
return i;
}
}
return -1;
}
new_links = [];
for(var j = 0; j < data.links.length; j++) {
start_index = getIndex(group_nodes, data.links[j].start);
end_index = getIndex(group_nodes, data.links[j].end);
new_link = {
'source': start_index,
'target': end_index,
'value': 1
};
new_links.push(new_link);
}
force
.nodes(group_nodes)
.links(new_links)
.start();
force.linkDistance(function(link) {
return link.distance;
// return link.graph === 0 ? height/2 : height/4;
});
var link = svg.selectAll(".link")
.data(new_links)
.enter().append("line")
.attr("class", "link")
.style("stroke-width", function(d) { return Math.sqrt(d.value); });
var node = svg.selectAll(".node")
.data(group_nodes)
.enter().append("g")
.attr("class", "node")
.call(force.drag);
node.append("circle")
.attr("class", "node")
.attr("x", -8)
.attr("y", -8)
.attr("r", 5)
.style("fill", function(d) { return color[d.line]; });
/*
node.append("text")
.attr("dx", 12)
.attr("dy", ".25em")
.attr("class", "smtext")
.text(function(d) { return d.name; });
*/
force.on("tick", function() {
link.attr("x1", function(d) { return d.source.x; })
.attr("y1", function(d) { return d.source.y; })
.attr("x2", function(d) { return d.target.x; })
.attr("y2", function(d) { return d.target.y; });
node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
/* node.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; }); */
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment