tynbl.github.io

网络可视化

import networkx as nx
import matplotlib.pyplot as plt

%matplotlib notebook
G = nx.read_gpickle('major_us_cities')
G.nodes(data=True)
[('Atlanta, GA', {'location': (-84, 33), 'population': 447841}),
 ('Cleveland, OH', {'location': (-81, 41), 'population': 390113}),
 ('Fresno, CA', {'location': (-119, 36), 'population': 509924}),
 ('Austin, TX', {'location': (-97, 30), 'population': 885400}),
 ('Houston, TX', {'location': (-95, 29), 'population': 2195914}),
 ('Denver, CO', {'location': (-104, 39), 'population': 649495}),
 ('Mesa, AZ', {'location': (-111, 33), 'population': 457587}),
 ('Tucson, AZ', {'location': (-110, 32), 'population': 526116}),
 ('Tulsa, OK', {'location': (-95, 36), 'population': 398121}),
 ('Oakland, CA', {'location': (-122, 37), 'population': 406253}),
 ('Indianapolis, IN', {'location': (-86, 39), 'population': 843393}),
 ('Seattle, WA', {'location': (-122, 47), 'population': 652405}),
 ('Detroit, MI', {'location': (-83, 42), 'population': 688701}),
 ('Chicago, IL', {'location': (-87, 41), 'population': 2718782}),
 ('San Antonio, TX', {'location': (-98, 29), 'population': 1409019}),
 ('San Diego, CA', {'location': (-117, 32), 'population': 1355896}),
 ('Los Angeles, CA', {'location': (-118, 34), 'population': 3884307}),
 ('Long Beach, CA', {'location': (-118, 33), 'population': 469428}),
 ('Phoenix, AZ', {'location': (-112, 33), 'population': 1513367}),
 ('Omaha, NE', {'location': (-95, 41), 'population': 434353}),
 ('Boston, MA', {'location': (-71, 42), 'population': 645966}),
 ('San Jose, CA', {'location': (-121, 37), 'population': 998537}),
 ('Fort Worth, TX', {'location': (-97, 32), 'population': 792727}),
 ('Minneapolis, MN', {'location': (-93, 44), 'population': 400070}),
 ('Colorado Springs, CO', {'location': (-104, 38), 'population': 439886}),
 ('New York, NY', {'location': (-74, 40), 'population': 8405837}),
 ('Raleigh, NC', {'location': (-78, 35), 'population': 431746}),
 ('Columbus, OH', {'location': (-82, 39), 'population': 822553}),
 ('Charlotte, NC', {'location': (-80, 35), 'population': 792862}),
 ('Milwaukee, WI', {'location': (-87, 43), 'population': 599164}),
 ('Washington D.C.', {'location': (-77, 38), 'population': 646449}),
 ('Albuquerque, NM', {'location': (-106, 35), 'population': 556495}),
 ('Nashville-Davidson, TN', {'location': (-86, 36), 'population': 634464}),
 ('Virginia Beach, VA', {'location': (-75, 36), 'population': 448479}),
 ('San Francisco, CA', {'location': (-122, 37), 'population': 837442}),
 ('Memphis, TN', {'location': (-90, 35), 'population': 653450}),
 ('Baltimore, MD', {'location': (-76, 39), 'population': 622104}),
 ('Kansas City, MO', {'location': (-94, 39), 'population': 467007}),
 ('El Paso, TX', {'location': (-106, 31), 'population': 674433}),
 ('Philadelphia, PA', {'location': (-75, 39), 'population': 1553165}),
 ('Portland, OR', {'location': (-122, 45), 'population': 609456}),
 ('Sacramento, CA', {'location': (-121, 38), 'population': 479686}),
 ('Louisville/Jefferson County, KY',
  {'location': (-85, 38), 'population': 609893}),
 ('Las Vegas, NV', {'location': (-115, 36), 'population': 603488}),
 ('New Orleans, LA', {'location': (-90, 29), 'population': 378715}),
 ('Arlington, TX', {'location': (-97, 32), 'population': 379577}),
 ('Dallas, TX', {'location': (-96, 32), 'population': 1257676}),
 ('Oklahoma City, OK', {'location': (-97, 35), 'population': 610613}),
 ('Jacksonville, FL', {'location': (-81, 30), 'population': 842583}),
 ('Wichita, KS', {'location': (-97, 37), 'population': 386552}),
 ('Miami, FL', {'location': (-80, 25), 'population': 417650})]
G.edges(data=True)
[('Atlanta, GA',
  'Louisville/Jefferson County, KY',
  {'weight': 515.3935693632964}),
 ('Atlanta, GA', 'Nashville-Davidson, TN', {'weight': 345.6125153590445}),
 ('Atlanta, GA', 'New Orleans, LA', {'weight': 682.384954857707}),
 ('Atlanta, GA', 'Memphis, TN', {'weight': 541.5047877131989}),
 ('Atlanta, GA', 'Columbus, OH', {'weight': 701.2644982560505}),
 ('Atlanta, GA', 'Jacksonville, FL', {'weight': 458.65574177422604}),
 ('Atlanta, GA', 'Charlotte, NC', {'weight': 363.83612586974465}),
 ('Atlanta, GA', 'Indianapolis, IN', {'weight': 687.1751452631671}),
 ('Atlanta, GA', 'Raleigh, NC', {'weight': 571.2185028690484}),
 ('Cleveland, OH',
  'Louisville/Jefferson County, KY',
  {'weight': 500.1707647725783}),
 ('Cleveland, OH', 'Chicago, IL', {'weight': 494.246407377749}),
 ('Cleveland, OH', 'Columbus, OH', {'weight': 203.17328268011585}),
 ('Cleveland, OH', 'Charlotte, NC', {'weight': 700.9265025725867}),
 ('Cleveland, OH', 'Detroit, MI', {'weight': 145.0420206213353}),
 ('Cleveland, OH', 'Milwaukee, WI', {'weight': 538.5642098043521}),
 ('Cleveland, OH', 'Washington D.C.', {'weight': 488.9898877488932}),
 ('Cleveland, OH', 'New York, NY', {'weight': 649.4502672715655}),
 ('Cleveland, OH', 'Nashville-Davidson, TN', {'weight': 738.354383567491}),
 ('Cleveland, OH', 'Virginia Beach, VA', {'weight': 713.1719915722457}),
 ('Cleveland, OH', 'Baltimore, MD', {'weight': 495.1075478023953}),
 ('Cleveland, OH', 'Philadelphia, PA', {'weight': 575.9173040784142}),
 ('Cleveland, OH', 'Indianapolis, IN', {'weight': 422.649765785015}),
 ('Cleveland, OH', 'Raleigh, NC', {'weight': 688.6125090133806}),
 ('Fresno, CA', 'San Diego, CA', {'weight': 507.4313769710358}),
 ('Fresno, CA', 'Las Vegas, NV', {'weight': 418.94992726715964}),
 ('Fresno, CA', 'San Francisco, CA', {'weight': 260.46960973345125}),
 ('Fresno, CA', 'Los Angeles, CA', {'weight': 329.89973534387246}),
 ('Fresno, CA', 'Long Beach, CA', {'weight': 360.4704577972272}),
 ('Fresno, CA', 'Oakland, CA', {'weight': 250.2309725980516}),
 ('Fresno, CA', 'Phoenix, AZ', {'weight': 789.7484331199684}),
 ('Fresno, CA', 'Sacramento, CA', {'weight': 253.9761318839872}),
 ('Fresno, CA', 'San Jose, CA', {'weight': 198.66400315450576}),
 ('Austin, TX', 'San Antonio, TX', {'weight': 118.36314806535839}),
 ('Austin, TX', 'Oklahoma City, OK', {'weight': 578.2822601911338}),
 ('Austin, TX', 'New Orleans, LA', {'weight': 738.1686404349225}),
 ('Austin, TX', 'Arlington, TX', {'weight': 280.8343387749554}),
 ('Austin, TX', 'Tulsa, OK', {'weight': 674.071176589555}),
 ('Austin, TX', 'Houston, TX', {'weight': 235.1985112721572}),
 ('Austin, TX', 'Fort Worth, TX', {'weight': 279.2607716124542}),
 ('Austin, TX', 'Dallas, TX', {'weight': 292.91146634693376}),
 ('Houston, TX', 'San Antonio, TX', {'weight': 304.1503947555647}),
 ('Houston, TX', 'Oklahoma City, OK', {'weight': 665.217514913665}),
 ('Houston, TX', 'New Orleans, LA', {'weight': 511.02384244889754}),
 ('Houston, TX', 'Arlington, TX', {'weight': 369.5566420759369}),
 ('Houston, TX', 'Tulsa, OK', {'weight': 712.8495434682451}),
 ('Houston, TX', 'Memphis, TN', {'weight': 779.1727315480448}),
 ('Houston, TX', 'Fort Worth, TX', {'weight': 381.3872407940769}),
 ('Houston, TX', 'Dallas, TX', {'weight': 361.54185907832755}),
 ('Denver, CO', 'Albuquerque, NM', {'weight': 536.4291827646916}),
 ('Denver, CO', 'Omaha, NE', {'weight': 777.8863249384502}),
 ('Denver, CO', 'Colorado Springs, CO', {'weight': 101.65075926223551}),
 ('Denver, CO', 'Wichita, KS', {'weight': 701.4183354835055}),
 ('Mesa, AZ', 'Tucson, AZ', {'weight': 157.26017307785148}),
 ('Mesa, AZ', 'Albuquerque, NM', {'weight': 514.5675468665884}),
 ('Mesa, AZ', 'San Diego, CA', {'weight': 502.32635614606744}),
 ('Mesa, AZ', 'Las Vegas, NV', {'weight': 429.8988310173471}),
 ('Mesa, AZ', 'Los Angeles, CA', {'weight': 596.6944422568216}),
 ('Mesa, AZ', 'Long Beach, CA', {'weight': 590.156204210031}),
 ('Mesa, AZ', 'El Paso, TX', {'weight': 536.256659972679}),
 ('Mesa, AZ', 'Phoenix, AZ', {'weight': 22.79553039579591}),
 ('Tucson, AZ', 'Albuquerque, NM', {'weight': 510.7965704802782}),
 ('Tucson, AZ', 'San Diego, CA', {'weight': 587.0077247254917}),
 ('Tucson, AZ', 'Las Vegas, NV', {'weight': 585.0709975647242}),
 ('Tucson, AZ', 'Los Angeles, CA', {'weight': 710.4231699340471}),
 ('Tucson, AZ', 'Long Beach, CA', {'weight': 698.6566667728368}),
 ('Tucson, AZ', 'El Paso, TX', {'weight': 425.41386739988224}),
 ('Tucson, AZ', 'Phoenix, AZ', {'weight': 173.37868185485377}),
 ('Tulsa, OK', 'San Antonio, TX', {'weight': 783.407957742418}),
 ('Tulsa, OK', 'Omaha, NE', {'weight': 566.5584360997123}),
 ('Tulsa, OK', 'Oklahoma City, OK', {'weight': 157.06950410857905}),
 ('Tulsa, OK', 'Arlington, TX', {'weight': 393.3587398321102}),
 ('Tulsa, OK', 'Wichita, KS', {'weight': 208.1658493855318}),
 ('Tulsa, OK', 'Memphis, TN', {'weight': 548.09611297848}),
 ('Tulsa, OK', 'Kansas City, MO', {'weight': 350.19665468058116}),
 ('Tulsa, OK', 'Fort Worth, TX', {'weight': 397.0462555225492}),
 ('Tulsa, OK', 'Dallas, TX', {'weight': 382.46410800205336}),
 ('Oakland, CA', 'San Diego, CA', {'weight': 730.9953136286227}),
 ('Oakland, CA', 'San Francisco, CA', {'weight': 13.428080525235567}),
 ('Oakland, CA', 'Los Angeles, CA', {'weight': 552.3121684216721}),
 ('Oakland, CA', 'Long Beach, CA', {'weight': 579.5829987228403}),
 ('Oakland, CA', 'Las Vegas, NV', {'weight': 658.3408716278288}),
 ('Oakland, CA', 'Sacramento, CA', {'weight': 109.82159793013636}),
 ('Oakland, CA', 'San Jose, CA', {'weight': 61.90292319070633}),
 ('Indianapolis, IN',
  'Louisville/Jefferson County, KY',
  {'weight': 171.93402850524834}),
 ('Indianapolis, IN', 'Chicago, IL', {'weight': 265.0916992417503}),
 ('Indianapolis, IN', 'Columbus, OH', {'weight': 270.3063479826381}),
 ('Indianapolis, IN', 'Charlotte, NC', {'weight': 688.3846733430148}),
 ('Indianapolis, IN', 'Detroit, MI', {'weight': 386.1408406535182}),
 ('Indianapolis, IN', 'Milwaukee, WI', {'weight': 391.5388446310555}),
 ('Indianapolis, IN', 'Washington D.C.', {'weight': 789.4034447188161}),
 ('Indianapolis, IN', 'Nashville-Davidson, TN', {'weight': 404.3913216129687}),
 ('Indianapolis, IN', 'Memphis, TN', {'weight': 617.295220276267}),
 ('Indianapolis, IN', 'Kansas City, MO', {'weight': 726.2520742478256}),
 ('Indianapolis, IN', 'Raleigh, NC', {'weight': 795.0096232862684}),
 ('Seattle, WA', 'Portland, OR', {'weight': 232.98003496425403}),
 ('Detroit, MI',
  'Louisville/Jefferson County, KY',
  {'weight': 508.16604231921934}),
 ('Detroit, MI', 'Nashville-Davidson, TN', {'weight': 756.943864661379}),
 ('Detroit, MI', 'Chicago, IL', {'weight': 381.2299668022458}),
 ('Detroit, MI', 'Baltimore, MD', {'weight': 637.6886783148906}),
 ('Detroit, MI', 'Columbus, OH', {'weight': 263.423764720247}),
 ('Detroit, MI', 'Philadelphia, PA', {'weight': 710.1462898578072}),
 ('Detroit, MI', 'New York, NY', {'weight': 772.9011410671837}),
 ('Detroit, MI', 'Milwaukee, WI', {'weight': 404.7034896583142}),
 ('Detroit, MI', 'Washington D.C.', {'weight': 633.5169854294026}),
 ('Chicago, IL',
  'Louisville/Jefferson County, KY',
  {'weight': 433.14201586073085}),
 ('Chicago, IL', 'Nashville-Davidson, TN', {'weight': 639.3273291549567}),
 ('Chicago, IL', 'Memphis, TN', {'weight': 776.6422940993197}),
 ('Chicago, IL', 'Columbus, OH', {'weight': 443.294756640302}),
 ('Chicago, IL', 'Kansas City, MO', {'weight': 663.1871353165795}),
 ('Chicago, IL', 'Omaha, NE', {'weight': 698.9473960021885}),
 ('Chicago, IL', 'Milwaukee, WI', {'weight': 130.97175617954392}),
 ('Chicago, IL', 'Minneapolis, MN', {'weight': 570.2677332774025}),
 ('San Antonio, TX', 'Oklahoma City, OK', {'weight': 677.788567153514}),
 ('San Antonio, TX', 'Fort Worth, TX', {'weight': 386.37486866810514}),
 ('San Antonio, TX', 'Arlington, TX', {'weight': 390.8981857027806}),
 ('San Antonio, TX', 'Dallas, TX', {'weight': 406.0065656782324}),
 ('San Diego, CA', 'Las Vegas, NV', {'weight': 426.17584242277843}),
 ('San Diego, CA', 'San Francisco, CA', {'weight': 737.1473892523547}),
 ('San Diego, CA', 'Los Angeles, CA', {'weight': 179.29746717246732}),
 ('San Diego, CA', 'Long Beach, CA', {'weight': 151.45008247402757}),
 ('San Diego, CA', 'San Jose, CA', {'weight': 669.6772910512424}),
 ('San Diego, CA', 'Phoenix, AZ', {'weight': 480.550984974869}),
 ('San Diego, CA', 'Sacramento, CA', {'weight': 760.0327691692984}),
 ('Los Angeles, CA', 'Las Vegas, NV', {'weight': 367.37280090555305}),
 ('Los Angeles, CA', 'San Francisco, CA', {'weight': 558.7708978607576}),
 ('Los Angeles, CA', 'Long Beach, CA', {'weight': 31.69419563651866}),
 ('Los Angeles, CA', 'San Jose, CA', {'weight': 491.244577392781}),
 ('Los Angeles, CA', 'Phoenix, AZ', {'weight': 573.9011736942347}),
 ('Los Angeles, CA', 'Sacramento, CA', {'weight': 581.3180718925387}),
 ('Long Beach, CA', 'Las Vegas, NV', {'weight': 385.2597725411484}),
 ('Long Beach, CA', 'San Francisco, CA', {'weight': 585.6985397766858}),
 ('Long Beach, CA', 'Phoenix, AZ', {'weight': 567.4125390872786}),
 ('Long Beach, CA', 'Sacramento, CA', {'weight': 611.0649790490104}),
 ('Long Beach, CA', 'San Jose, CA', {'weight': 518.2330606219175}),
 ('Phoenix, AZ', 'Albuquerque, NM', {'weight': 534.0407586326625}),
 ('Phoenix, AZ', 'Las Vegas, NV', {'weight': 411.9094912462262}),
 ('Phoenix, AZ', 'El Paso, TX', {'weight': 558.7835703774161}),
 ('Omaha, NE', 'Oklahoma City, OK', {'weight': 656.2791186480706}),
 ('Omaha, NE', 'Milwaukee, WI', {'weight': 695.28556620892}),
 ('Omaha, NE', 'Minneapolis, MN', {'weight': 469.53764600116483}),
 ('Omaha, NE', 'Wichita, KS', {'weight': 412.2771985083082}),
 ('Omaha, NE', 'Colorado Springs, CO', {'weight': 796.8394903997096}),
 ('Omaha, NE', 'Kansas City, MO', {'weight': 267.84598679216094}),
 ('Boston, MA', 'Baltimore, MD', {'weight': 578.0875135253946}),
 ('Boston, MA', 'Virginia Beach, VA', {'weight': 742.5833491609084}),
 ('Boston, MA', 'Philadelphia, PA', {'weight': 435.35607915456563}),
 ('Boston, MA', 'New York, NY', {'weight': 305.91369197099885}),
 ('Boston, MA', 'Washington D.C.', {'weight': 633.2724255670316}),
 ('San Jose, CA', 'San Francisco, CA', {'weight': 67.53245690690382}),
 ('San Jose, CA', 'Las Vegas, NV', {'weight': 614.3930568650861}),
 ('San Jose, CA', 'Sacramento, CA', {'weight': 142.37168354889943}),
 ('Fort Worth, TX', 'Oklahoma City, OK', {'weight': 301.86279118630887}),
 ('Fort Worth, TX', 'New Orleans, LA', {'weight': 755.8533393744848}),
 ('Fort Worth, TX', 'Arlington, TX', {'weight': 20.930696675141498}),
 ('Fort Worth, TX', 'Wichita, KS', {'weight': 548.2249270170437}),
 ('Fort Worth, TX', 'Memphis, TN', {'weight': 721.7845495553929}),
 ('Fort Worth, TX', 'Kansas City, MO', {'weight': 747.1268740996313}),
 ('Fort Worth, TX', 'Dallas, TX', {'weight': 49.93359898977102}),
 ('Minneapolis, MN', 'Kansas City, MO', {'weight': 662.1046217957743}),
 ('Minneapolis, MN', 'Milwaukee, WI', {'weight': 479.28775968088723}),
 ('Colorado Springs, CO', 'Albuquerque, NM', {'weight': 445.6400042319895}),
 ('Colorado Springs, CO', 'Oklahoma City, OK', {'weight': 747.014568661214}),
 ('Colorado Springs, CO', 'Wichita, KS', {'weight': 665.1967107484711}),
 ('Colorado Springs, CO', 'El Paso, TX', {'weight': 797.7517116740046}),
 ('New York, NY', 'Virginia Beach, VA', {'weight': 461.65690712679395}),
 ('New York, NY', 'Columbus, OH', {'weight': 765.9634514216572}),
 ('New York, NY', 'Baltimore, MD', {'weight': 272.38422181145063}),
 ('New York, NY', 'Washington D.C.', {'weight': 327.37847523720734}),
 ('New York, NY', 'Philadelphia, PA', {'weight': 129.53654818016477}),
 ('New York, NY', 'Raleigh, NC', {'weight': 680.9077807661519}),
 ('Raleigh, NC',
  'Louisville/Jefferson County, KY',
  {'weight': 688.7073656910881}),
 ('Raleigh, NC', 'Columbus, OH', {'weight': 601.698772359296}),
 ('Raleigh, NC', 'Charlotte, NC', {'weight': 208.69979892270072}),
 ('Raleigh, NC', 'Nashville-Davidson, TN', {'weight': 733.3988290802547}),
 ('Raleigh, NC', 'Virginia Beach, VA', {'weight': 266.37385856851193}),
 ('Raleigh, NC', 'Jacksonville, FL', {'weight': 667.2967757561717}),
 ('Raleigh, NC', 'Baltimore, MD', {'weight': 429.0122832219615}),
 ('Raleigh, NC', 'Washington D.C.', {'weight': 375.22530610803875}),
 ('Raleigh, NC', 'Philadelphia, PA', {'weight': 554.7433742861185}),
 ('Columbus, OH',
  'Louisville/Jefferson County, KY',
  {'weight': 304.39564005336484}),
 ('Columbus, OH', 'Charlotte, NC', {'weight': 559.2175271096321}),
 ('Columbus, OH', 'Milwaukee, WI', {'weight': 532.5684227398444}),
 ('Columbus, OH', 'Washington D.C.', {'weight': 524.8211194461829}),
 ('Columbus, OH', 'Nashville-Davidson, TN', {'weight': 536.2745483969072}),
 ('Columbus, OH', 'Virginia Beach, VA', {'weight': 701.8766661783677}),
 ('Columbus, OH', 'Baltimore, MD', {'weight': 551.5744271908803}),
 ('Columbus, OH', 'Philadelphia, PA', {'weight': 667.0538288622043}),
 ('Charlotte, NC',
  'Louisville/Jefferson County, KY',
  {'weight': 551.7938053643243}),
 ('Charlotte, NC', 'Washington D.C.', {'weight': 530.1200050223144}),
 ('Charlotte, NC', 'Nashville-Davidson, TN', {'weight': 545.8353443886101}),
 ('Charlotte, NC', 'Virginia Beach, VA', {'weight': 472.95036855569816}),
 ('Charlotte, NC', 'Jacksonville, FL', {'weight': 549.2112199489682}),
 ('Charlotte, NC', 'Baltimore, MD', {'weight': 586.2855475627688}),
 ('Charlotte, NC', 'Philadelphia, PA', {'weight': 724.7428432701282}),
 ('Milwaukee, WI',
  'Louisville/Jefferson County, KY',
  {'weight': 561.8059932331587}),
 ('Milwaukee, WI', 'Nashville-Davidson, TN', {'weight': 770.1467064269982}),
 ('Milwaukee, WI', 'Kansas City, MO', {'weight': 709.5921370123627}),
 ('Washington D.C.',
  'Louisville/Jefferson County, KY',
  {'weight': 760.8391296292245}),
 ('Washington D.C.', 'Virginia Beach, VA', {'weight': 246.445149222362}),
 ('Washington D.C.', 'Baltimore, MD', {'weight': 56.16567491112449}),
 ('Washington D.C.', 'Philadelphia, PA', {'weight': 198.24371380666594}),
 ('Albuquerque, NM', 'Las Vegas, NV', {'weight': 779.953416852203}),
 ('Albuquerque, NM', 'El Paso, TX', {'weight': 367.88584356108345}),
 ('Nashville-Davidson, TN',
  'Louisville/Jefferson County, KY',
  {'weight': 249.27549074119767}),
 ('Nashville-Davidson, TN', 'New Orleans, LA', {'weight': 755.0752949754904}),
 ('Nashville-Davidson, TN', 'Memphis, TN', {'weight': 315.75011030810685}),
 ('Nashville-Davidson, TN', 'Kansas City, MO', {'weight': 759.4820459793341}),
 ('Virginia Beach, VA', 'Baltimore, MD', {'weight': 276.4842802839367}),
 ('Virginia Beach, VA', 'Philadelphia, PA', {'weight': 351.6415980651635}),
 ('San Francisco, CA', 'Las Vegas, NV', {'weight': 670.2380164875032}),
 ('San Francisco, CA', 'Sacramento, CA', {'weight': 120.68134676034228}),
 ('Memphis, TN',
  'Louisville/Jefferson County, KY',
  {'weight': 514.7054394176082}),
 ('Memphis, TN', 'New Orleans, LA', {'weight': 577.6842584479515}),
 ('Memphis, TN', 'Arlington, TX', {'weight': 703.6616239985909}),
 ('Memphis, TN', 'Dallas, TX', {'weight': 675.3316242841653}),
 ('Memphis, TN', 'Oklahoma City, OK', {'weight': 677.9358508494545}),
 ('Memphis, TN', 'Wichita, KS', {'weight': 709.8334440883956}),
 ('Memphis, TN', 'Kansas City, MO', {'weight': 594.6054291939741}),
 ('Baltimore, MD', 'Philadelphia, PA', {'weight': 144.0640481858552}),
 ('Kansas City, MO',
  'Louisville/Jefferson County, KY',
  {'weight': 770.6369007007506}),
 ('Kansas City, MO', 'Dallas, TX', {'weight': 730.377587942699}),
 ('Kansas City, MO', 'Oklahoma City, OK', {'weight': 479.91486422643885}),
 ('Kansas City, MO', 'Wichita, KS', {'weight': 286.7887192519942}),
 ('Kansas City, MO', 'Arlington, TX', {'weight': 742.8459954761595}),
 ('Portland, OR', 'Sacramento, CA', {'weight': 777.4903265797615}),
 ('Sacramento, CA', 'Las Vegas, NV', {'weight': 621.6693471839634}),
 ('New Orleans, LA', 'Arlington, TX', {'weight': 735.8026229506348}),
 ('New Orleans, LA', 'Dallas, TX', {'weight': 711.0141469371868}),
 ('Arlington, TX', 'Oklahoma City, OK', {'weight': 305.89535561943643}),
 ('Arlington, TX', 'Wichita, KS', {'weight': 550.8138003458517}),
 ('Arlington, TX', 'Dallas, TX', {'weight': 29.425931317908415}),
 ('Dallas, TX', 'Oklahoma City, OK', {'weight': 306.2597807397289}),
 ('Dallas, TX', 'Wichita, KS', {'weight': 548.0572491959326}),
 ('Oklahoma City, OK', 'Wichita, KS', {'weight': 247.36915356065145}),
 ('Jacksonville, FL', 'Miami, FL', {'weight': 527.7797119911229})]
plt.figure(figsize=(10, 9))
nx.draw_networkx(G)
<IPython.core.display.Javascript object>

# 网络布局
[x for x in nx.__dir__() if x.endswith('_layout')]
['circular_layout',
 'random_layout',
 'shell_layout',
 'spring_layout',
 'spectral_layout',
 'fruchterman_reingold_layout',
 'graphviz_layout',
 'pygraphviz_layout']
plt.figure(figsize=(10, 9))
pos = nx.random_layout(G)
nx.draw_networkx(G, pos)
<IPython.core.display.Javascript object>

plt.figure(figsize=(10, 9))
pos = nx.circular_layout(G)
nx.draw_networkx(G, pos)
<IPython.core.display.Javascript object>

# 自定义布局
plt.figure(figsize=(10, 7))

pos = nx.get_node_attributes(G, 'location')
nx.draw_networkx(G, pos)
<IPython.core.display.Javascript object>

plt.figure(figsize=(10, 7))

nx.draw_networkx(G, pos, alpha=0.7, with_labels=False, edge_color='.4')
plt.axis('off')
plt.tight_layout()
<IPython.core.display.Javascript object>

plt.figure(figsize=(10, 7))

node_color = [G.degree(v) for v in G]
node_size = [0.0005 * nx.get_node_attributes(G, 'population')[v] for v in G]
edge_width = [0.0015 * G[u][v]['weight'] for u, v in G.edges()]

nx.draw_networkx(G, pos, node_size=node_size,
                node_color=node_color, alpha=0.7, with_labels=False,
                width=edge_width, edge_color='.4', cmap=plt.cm.Blues)
plt.axis('off')
plt.tight_layout()
<IPython.core.display.Javascript object>

plt.figure(figsize=(10, 7))

node_color = [G.degree(v) for v in G]
node_size = [0.0005 * nx.get_node_attributes(G, 'population')[v] for v in G]
edge_width = [0.0015 * G[u][v]['weight'] for u, v in G.edges()]

nx.draw_networkx(G, pos, node_size=node_size,
                node_color=node_color, alpha=0.7, with_labels=False,
                width=edge_width, edge_color='.4', cmap=plt.cm.Blues)

greater_than_770 = [x for x in G.edges(data=True) if x[2]['weight']>770]
nx.draw_networkx_edges(G, pos, edgelist=greater_than_770, edge_color='r', alpha=0.4, width=6)

nx.draw_networkx_labels(G, pos, labels={'Los Angeles, CA': 'LA', 'New York, NY': 'NYC'},
                       font_size=18, font_color='w')

plt.axis('off')
plt.tight_layout()
<IPython.core.display.Javascript object>