import csv from turtle import color from pyecharts import options as opts from pyecharts.charts import Graph
csv_reader = csv.reader(open("./relation.csv")) systems = [] relation=[] for left in csv_reader: l = left[0]; r = left[1]; relation.append({"main":l,"sub":r}) systems.append(l) systems.append(r)
# 节点 nodes = [] for i inlist(set(systems)): nodes.append({"name": i, "symbolSize": 15})#systems.count(i) 10就是点的大小
# 关系 links = [] for i in nodes: for j in relation: if(i.get("name") == j.get("main")): links.append({"source": i.get("name"), "target": j.get("sub")})