Lect 07: Bipartite Graphs with Networkx ||Bipartite Graphs using Python

Publicado em: 29 Maio 2022
no canal de: Data Science Center
2,426
25

Edges are only allowed across different sets and are not allowed within nodes belonging
to the same set. In most cases, nodes belonging to different sets are also characterized by
particular node types.

from networkx.drawing.layout import bipartite_layout

user = ['A', 'B', 'C', 'D', 'E']
item = [1, 2, 3, 4, 5]
E = zip(np.random.choice(user, 10), np.random.choice(item, 10))

Edge = pd.DataFrame([{"source":user, "target":item} for user, item in E])
G.add_nodes_from(user, bipartite=0)
G.add_nodes_from(item, bipartite=1)

G.add_edges_from(tuple(x) for x in Edge.values)


plt.figure(figsize=(10, 10))
nx.draw_networkx(G, pos, node_size= 1700, edge_color='g', node_color='r', arrowsize=32, font_size=14, with_labels=True)
plt.show()


Nesta página do site você pode assistir ao vídeo on-line Lect 07: Bipartite Graphs with Networkx ||Bipartite Graphs using Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Data Science Center 29 Maio 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,426 vezes e gostou 25 espectadores. Boa visualização!