0

Given the Erdos-Reyni graph below, is there anyway to convert/transform this graph with its respective properties and node attributes to a decorative and interactive graph type like pyvis?

   attributes = {}
   for node in node_ids:
       attributes[node] = {}
       attributes[node]['colour'] = colours[node]
       attributes[node]['opinion'] = opinions[node]
       attributes[node]['certainty'] = node_certainties[node]

   # Erdos-Reyni graph generation with attributes
   er_graph = nx.erdos_renyi_graph(self.num, self.probability)
   er_graph.add_nodes_from(grey_ids)
   er_graph.add_node(red_node)
   er_graph.add_node(blue_node)
   nx.set_node_attributes(er_graph, attributes)

   colour_map = []

   for node in graph:
       colour_map.append(graph.nodes[node]["colour"])

   nx.draw_circular(graph, node_color = colour_map, with_labels=True)
   plt.show()
Sohaib
  • 61
  • 7

0 Answers0