If you have a large CSV, I would recommend using pandas as part of the I / O of your task. networkx has a useful method for interacting with pandas called from_pandas_dataframe . Assuming your data is in csv format in the above format, this command should work for you:
df = pd.read_csv('path/to/file.csv', columns=['node1', 'node2', 'weight'])
But for demonstration, I will use 10 random edges according to your requirements (you will not need to import numpy , I just use it to generate random numbers):
import matplotlib as plt import networkx as nx import pandas as pd
Everything in the previous block should generate the same as your pd.read_csv command. The result of this DataFrame, df :
node1 node2 weight 0 16 13 0.548814 1 17 15 0.715189 2 17 10 0.602763 3 18 12 0.544883 4 11 13 0.423655 5 15 18 0.645894 6 18 11 0.437587 7 14 13 0.891773 8 13 13 0.963663 9 10 13 0.383442
Use from_pandas_dataframe to initialize the MultiGraph . This assumes that you will have multiple edges connecting to one node (not specified in the OP). To use this method, you will need to easily modify the networkx source code in the networkx file implemented here (it was a simple mistake).
MG = nx.from_pandas_dataframe(df, 'node1', 'node2', edge_attr='weight', create_using=nx.MultiGraph() )
This generates a MultiGraph, you can visualize it using draw :
positions = nx.spring_layout(MG) # saves the positions of the nodes on the visualization # pass positions and set hold=True nx.draw(MG, pos=positions, hold=True, with_labels=True, node_size=1000, font_size=16)
More details: positions is a dictionary where each node is a key, and the value is a position on the chart. I will describe why we store positions below. A common draw will draw your instance of MultiGraph MG with the nodes at the specified positions . However, since you can see that the edges have the same width:

But you have everything you need to add weights. First enter the scales in a list called weights . Iteration (with a list) through each edge with edges , we can extract the weight. I decided to multiply by 5 because it looked the cleanest:
weights = [w[2]['weight']*5 for w in MG.edges(data=True)]
Finally, we will use draw_networkx_edges , which only draws the edges of the graph (without nodes). Since we have the positions nodes and we set hold=True , we can draw weighted edges directly on top of our previous visualization.
nx.draw_networkx_edges(MG, pos=positions, width=weights)

You can see that node (14, 13) has the heaviest row and the largest value from the DataFrame df (except (13,13) ).