Python drawing BA scale-free network __python

Source: Internet
Author: User

#Copyright (c) 2017, School of Software of Northeastern University
# all rightsreserved
#文件名称: a.py
#:   Kongyun
#问题描述:
#问题分析:. The code is as follows:
import networkx as ne #导入建网络模型包, named ne
import matplotlib.pyplot as MP #导入科学绘图包, named MP
#BA Scale-free Degree network graphy
ba=ne.barabasi_albert_graph (50,1)
ps=ne.spring_layout (BA) #布置框架
ne.draw (BA, ps,with_labels=false,node_size=30)
mp.show ()

Run Result:


Note: The Barabasi_albert_graph (n, m) method is used to generate a BA scale-free network containing n nodes and adding m bars at a time. This method generates 50 nodes in this program, each adding a 1-edge BA scale network graph.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.