I have a data frame where I have five columns. First two columns are the
source and sink nodes of interaction while the other three columns are three
kinds of edge properties.

*import pandas as pd
import graph_tool as gt


df = pd.DataFrame({'S':['a','b','c'],  'D':['b','c','a'], 
'w1':[0.2,0.5,0.6], 'w2':[0.4,0.55,0.99], 'w3':[1,3,5]})

g = gt.Graph()

eprop1 = g.new_edge_property('float')
eprop2 = g.new_edge_property('float')
eprop3 = g.new_edge_property('int')*


Now if I want to add this to the properties to my network then

*g.edge_properties['eprop1'] = eprop1
g.edge_properties['eprop2'] = eprop2
g.edge_properties['eprop3'] = eprop3
*

and to assign values to the edge properties to the network I can write the
command

*g.add_edge_list(df.values.tolist(),hashed=True,
string_vals=True,eprops=[eprop1])
*

My question is: *'How do I assign values to the other two edge properties
eprop2 and eprop3 from the 
DataFrame columns ?*

Something like, I guess:

*g.add_edge_list(df.values.tolist(),hashed=True,
string_vals=True,eprops=[eprop1,eprop2,eprop3])
*

I tried this but it doesn't work.







--
Sent from: 
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to