0

I have plotted a graph using pyvis.network like the following:

import networkx as nx
from pyvis.network import Network
G = nx.from_pandas_edgelist(df, source = 'Node1', target='Node2')
net = Network(notebook=True)
net.from_nx(G)
net.show('BRCA_sigpairs.html')

However, the resulting graph has a value of one on every edge like the following: enter image description here How can I disable these values on the edges? I tired to set edge_attr argument in the nx.from_pandas_edgelist() function as None or 0 but it didn't work.

Kaihua Hou
  • 310
  • 1
  • 2
  • 11
  • 1
    can you share sample df? i reproduced your code using karate club graph and its not showing these weights. – micro5 Apr 26 '22 at 05:17

2 Answers2

0

Add the parameter edge_attr=None:

G = nx.from_pandas_edgelist(df, source = 'Node1', target='Node2', edge_attr=None)
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
0

I solved this problem. i was not used from_pandas_edgelist()

edges = nx_graph.add_edge(cur_node, neighbor_node, weight='')

I solved this problem to add weight=''.

I want to solve the problem in this way