小编dsm*_*ess的帖子

Networkx pyvis:更改节点的颜色

我有一个数据框,其中包含source:人员 1、:target人员 2 和in_rewards_program:二进制。

我使用 pyvis 包创建了一个网络”


got_net = Network(notebook=True, height="750px", width="100%")
# got_net = Network(notebook=True, height="750px", width="100%", bgcolor="#222222", font_color="white")


# set the physics layout of the network
got_net.barnes_hut()
got_data = df

sources = got_data['source']
targets = got_data['target']

# create graph using pviz network 
edge_data = zip(sources, targets)

for e in edge_data:
    src = e[0]
    dst = e[1]

    #add nodes and edges to the graph
    got_net.add_node(src, src, title=src)
    got_net.add_node(dst, dst, title=dst)
    got_net.add_edge(src, dst)

neighbor_map …
Run Code Online (Sandbox Code Playgroud)

html networkx pandas

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

html ×1

networkx ×1

pandas ×1