{"id":440,"date":"2021-02-28T20:22:25","date_gmt":"2021-02-28T14:22:25","guid":{"rendered":"http:\/\/www.jichangqing.net\/wordpress\/?p=440"},"modified":"2021-02-28T20:22:25","modified_gmt":"2021-02-28T14:22:25","slug":"%e7%94%a8networkx%e7%bb%98%e5%88%b6%e5%b8%a6%e9%a2%9c%e8%89%b2%e6%b8%90%e5%8f%98%e7%9a%84%e6%9c%89%e5%90%91%e5%9b%be","status":"publish","type":"post","link":"http:\/\/www.jichangqing.net\/wordpress\/?p=440","title":{"rendered":"\u7528networkx\u7ed8\u5236\u5e26\u989c\u8272\u6e10\u53d8\u7684\u6709\u5411\u56fe"},"content":{"rendered":"<h1 style=\"font-weight: bold; color: #404040;\">\u7528networkx\u7ed8\u5236\u5e26\u989c\u8272\u6e10\u53d8\u7684\u6709\u5411\u56fe<\/h1>\n<p style=\"color: #404040;\">Draw a graph with directed edges using a colormap and different node sizes.<\/p>\n<p style=\"color: #404040;\">Edges have different colors and alphas (opacity). Drawn using matplotlib.<\/p>\n<p><img decoding=\"async\" class=\"sphx-glr-single-img\" style=\"color: #404040;\" src=\"https:\/\/networkx.org\/documentation\/latest\/_images\/sphx_glr_plot_directed_001.png\" alt=\"plot directed\" \/><\/p>\n<div class=\"highlight-default notranslate\" style=\"color: #404040;\">\n<div class=\"highlight\">\n<pre><span class=\"kn\" style=\"font-weight: bold; color: #007020;\">import<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">matplotlib<\/span> <span class=\"k\" style=\"font-weight: bold; color: #007020;\">as<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">mpl<\/span>\r\n<span class=\"kn\" style=\"font-weight: bold; color: #007020;\">import<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">matplotlib.pyplot<\/span> <span class=\"k\" style=\"font-weight: bold; color: #007020;\">as<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">plt<\/span>\r\n<span class=\"kn\" style=\"font-weight: bold; color: #007020;\">import<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">networkx<\/span> <span class=\"k\" style=\"font-weight: bold; color: #007020;\">as<\/span> <span class=\"nn\" style=\"font-weight: bold; color: #0e84b5;\">nx<\/span>\r\n\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">seed<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"mi\" style=\"color: #208050;\">13648<\/span>  <span class=\"c1\" style=\"font-style: italic; color: #408090;\"># Seed random number generators for reproducibility<\/span>\r\n<span class=\"n\">G<\/span> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"n\">nx<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">random_k_out_graph<\/span><span class=\"p\">(<\/span><span class=\"mi\" style=\"color: #208050;\">10<\/span><span class=\"p\">,<\/span> <span class=\"mi\" style=\"color: #208050;\">3<\/span><span class=\"p\">,<\/span> <span class=\"mf\" style=\"color: #208050;\">0.5<\/span><span class=\"p\">,<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">seed<\/a><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">seed<\/a><span class=\"p\">)<\/span>\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.dict\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">pos<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"n\">nx<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">spring_layout<\/span><span class=\"p\">(<\/span><span class=\"n\">G<\/span><span class=\"p\">,<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">seed<\/a><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">seed<\/a><span class=\"p\">)<\/span>\r\n\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">node_sizes<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"p\">[<\/span><span class=\"mi\" style=\"color: #208050;\">3<\/span> <span class=\"o\" style=\"color: #666666;\">+<\/span> <span class=\"mi\" style=\"color: #208050;\">10<\/span> <span class=\"o\" style=\"color: #666666;\">*<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a> <span class=\"k\" style=\"font-weight: bold; color: #007020;\">for<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a> <span class=\"ow\" style=\"font-weight: bold; color: #007020;\">in<\/span> <span class=\"nb\" style=\"color: #007020;\">range<\/span><span class=\"p\">(<\/span><span class=\"nb\" style=\"color: #007020;\">len<\/span><span class=\"p\">(<\/span><span class=\"n\">G<\/span><span class=\"p\">))]<\/span>\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">M<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"n\">G<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">number_of_edges<\/span><span class=\"p\">()<\/span>\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.range\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#range\">edge_colors<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"nb\" style=\"color: #007020;\">range<\/span><span class=\"p\">(<\/span><span class=\"mi\" style=\"color: #208050;\">2<\/span><span class=\"p\">,<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">M<\/a> <span class=\"o\" style=\"color: #666666;\">+<\/span> <span class=\"mi\" style=\"color: #208050;\">2<\/span><span class=\"p\">)<\/span>\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">edge_alphas<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"p\">[(<\/span><span class=\"mi\" style=\"color: #208050;\">5<\/span> <span class=\"o\" style=\"color: #666666;\">+<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a><span class=\"p\">)<\/span> <span class=\"o\" style=\"color: #666666;\">\/<\/span> <span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">M<\/a> <span class=\"o\" style=\"color: #666666;\">+<\/span> <span class=\"mi\" style=\"color: #208050;\">4<\/span><span class=\"p\">)<\/span> <span class=\"k\" style=\"font-weight: bold; color: #007020;\">for<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a> <span class=\"ow\" style=\"font-weight: bold; color: #007020;\">in<\/span> <span class=\"nb\" style=\"color: #007020;\">range<\/span><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">M<\/a><span class=\"p\">)]<\/span>\r\n<a class=\"sphx-glr-backref-module-matplotlib-colors sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.colors.ListedColormap\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap\">cmap<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <a class=\"sphx-glr-backref-module-matplotlib-colors sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.colors.ListedColormap\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap\"><span class=\"n\">plt<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">cm<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">plasma<\/span><\/a>\r\n\r\n<a class=\"sphx-glr-backref-module-matplotlib-collections sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.collections.PathCollection\" href=\"https:\/\/matplotlib.org\/api\/collections_api.html#matplotlib.collections.PathCollection\">nodes<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"n\">nx<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">draw_networkx_nodes<\/span><span class=\"p\">(<\/span><span class=\"n\">G<\/span><span class=\"p\">,<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.dict\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">pos<\/a><span class=\"p\">,<\/span> <span class=\"n\">node_size<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">node_sizes<\/a><span class=\"p\">,<\/span> <span class=\"n\">node_color<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><span class=\"s2\" style=\"color: #4070a0;\">\"indigo\"<\/span><span class=\"p\">)<\/span>\r\n<a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">edges<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <span class=\"n\">nx<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">draw_networkx_edges<\/span><span class=\"p\">(<\/span>\r\n    <span class=\"n\">G<\/span><span class=\"p\">,<\/span>\r\n    <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.dict\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#dict\">pos<\/a><span class=\"p\">,<\/span>\r\n    <span class=\"n\">node_size<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">node_sizes<\/a><span class=\"p\">,<\/span>\r\n    <span class=\"n\">arrowstyle<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><span class=\"s2\" style=\"color: #4070a0;\">\"-&gt;\"<\/span><span class=\"p\">,<\/span>\r\n    <span class=\"n\">arrowsize<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><span class=\"mi\" style=\"color: #208050;\">10<\/span><span class=\"p\">,<\/span>\r\n    <span class=\"n\">edge_color<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.range\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#range\">edge_colors<\/a><span class=\"p\">,<\/span>\r\n    <span class=\"n\">edge_cmap<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-matplotlib-colors sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.colors.ListedColormap\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap\">cmap<\/a><span class=\"p\">,<\/span>\r\n    <span class=\"n\">width<\/span><span class=\"o\" style=\"color: #666666;\">=<\/span><span class=\"mi\" style=\"color: #208050;\">2<\/span><span class=\"p\">,<\/span>\r\n<span class=\"p\">)<\/span>\r\n<span class=\"c1\" style=\"font-style: italic; color: #408090;\"># set alpha value for each edge<\/span>\r\n<span class=\"k\" style=\"font-weight: bold; color: #007020;\">for<\/span> <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a> <span class=\"ow\" style=\"font-weight: bold; color: #007020;\">in<\/span> <span class=\"nb\" style=\"color: #007020;\">range<\/span><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">M<\/a><span class=\"p\">):<\/span>\r\n    <a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">edges<\/a><span class=\"p\">[<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a><span class=\"p\">]<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">set_alpha<\/span><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">edge_alphas<\/a><span class=\"p\">[<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.int\" href=\"https:\/\/docs.python.org\/3\/library\/functions.html#int\">i<\/a><span class=\"p\">])<\/span>\r\n\r\n<a class=\"sphx-glr-backref-module-matplotlib-collections sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.collections.PatchCollection\" href=\"https:\/\/matplotlib.org\/api\/collections_api.html#matplotlib.collections.PatchCollection\">pc<\/a> <span class=\"o\" style=\"color: #666666;\">=<\/span> <a class=\"sphx-glr-backref-module-matplotlib-collections sphx-glr-backref-type-py-class\" style=\"color: #9b59b6;\" title=\"matplotlib.collections.PatchCollection\" href=\"https:\/\/matplotlib.org\/api\/collections_api.html#matplotlib.collections.PatchCollection\"><span class=\"n\">mpl<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">collections<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">PatchCollection<\/span><\/a><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.list\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#list\">edges<\/a><span class=\"p\">,<\/span> <a class=\"sphx-glr-backref-module-matplotlib-colors sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.colors.ListedColormap\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap\">cmap<\/a><span class=\"o\" style=\"color: #666666;\">=<\/span><a class=\"sphx-glr-backref-module-matplotlib-colors sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.colors.ListedColormap\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap\">cmap<\/a><span class=\"p\">)<\/span>\r\n<a class=\"sphx-glr-backref-module-matplotlib-collections sphx-glr-backref-type-py-method\" style=\"color: #9b59b6;\" title=\"matplotlib.collections.PatchCollection.set_array\" href=\"https:\/\/matplotlib.org\/api\/collections_api.html#matplotlib.collections.PatchCollection.set_array\"><span class=\"n\">pc<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">set_array<\/span><\/a><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"builtins.range\" href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#range\">edge_colors<\/a><span class=\"p\">)<\/span>\r\n<a class=\"sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function\" style=\"color: #9b59b6;\" title=\"matplotlib.pyplot.colorbar\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.pyplot.colorbar.html#matplotlib.pyplot.colorbar\"><span class=\"n\">plt<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">colorbar<\/span><\/a><span class=\"p\">(<\/span><a class=\"sphx-glr-backref-module-matplotlib-collections sphx-glr-backref-type-py-class sphx-glr-backref-instance\" style=\"color: #9b59b6;\" title=\"matplotlib.collections.PatchCollection\" href=\"https:\/\/matplotlib.org\/api\/collections_api.html#matplotlib.collections.PatchCollection\">pc<\/a><span class=\"p\">)<\/span>\r\n\r\n<span class=\"n\">ax<\/span> <span class=\"o\" style=\"color: #666666;\">=<\/span> <a class=\"sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function\" style=\"color: #9b59b6;\" title=\"matplotlib.pyplot.gca\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.pyplot.gca.html#matplotlib.pyplot.gca\"><span class=\"n\">plt<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">gca<\/span><\/a><span class=\"p\">()<\/span>\r\n<a class=\"sphx-glr-backref-module-matplotlib-axes sphx-glr-backref-type-py-method\" style=\"color: #9b59b6;\" title=\"matplotlib.axes.Axes.set_axis_off\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.axes.Axes.set_axis_off.html#matplotlib.axes.Axes.set_axis_off\"><span class=\"n\">ax<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">set_axis_off<\/span><\/a><span class=\"p\">()<\/span>\r\n<a class=\"sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function\" style=\"color: #9b59b6;\" title=\"matplotlib.pyplot.show\" href=\"https:\/\/matplotlib.org\/api\/_as_gen\/matplotlib.pyplot.show.html#matplotlib.pyplot.show\"><span class=\"n\">plt<\/span><span class=\"o\" style=\"color: #666666;\">.<\/span><span class=\"n\">show<\/span><\/a><span class=\"p\">()<\/span><\/pre>\n<\/div>\n<\/div>\n<p>from: https:\/\/networkx.org\/documentation\/latest\/auto_examples\/drawing\/plot_directed.html#sphx-glr-auto-examples-drawing-plot-directed-py<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528networkx\u7ed8\u5236\u5e26\u989c\u8272\u6e10\u53d8\u7684\u6709\u5411\u56fe Draw a graph with directed edges using a colormap and different node sizes. Edges have different co &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=440"}],"version-history":[{"count":1,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/440\/revisions"}],"predecessor-version":[{"id":441,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/440\/revisions\/441"}],"wp:attachment":[{"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jichangqing.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}