上传者: 38537541
|
上传时间: 2021-10-25 15:34:04
|
文件大小: 47KB
|
文件类型: -
首先输入边和边的权重,随后画出节点位置,根据权重大小划分实边和虚边
#coding:utf-8
#!/usr/bin/env python
An example using Graph as a weighted network.
__author__ = Aric Hagberg (hagberg@lanl.gov)
try:
import matplotlib.pyplot as plt
except:
raise
import networkx as nx
G=nx.Graph()
#添加带权边
G.add_edge('a','b',weight=