Edge property map for int type

pdat =
pd.DataFrame({'source':['A','B','C'],'target':['p','q','r'],'weight':[1,-1,2]})

graph = gt.Graph(directed=True)
eprop = graph.new_edge_property("vector<int>")

vprop =
graph.add_edge_list(pdat[['source','target','weight']].values.tolist(),
                                           
hashed=True,string_vals=True,eprops=[eprop])

I get the error

TypeError: 'int' object is not iterable

But not when the eprop is <string>

I know I am missing something, but the property map page in the
documentation doesn't elaborate clearly.

Hi Ashuein,

You're trying to push `int` values into a `vector<int>` type. You should
use a `int` for the property map instead.

.~'

pdat =

pd.DataFrame({'source':['A','B','C'],'target':['p','q','r'],'weight':[1,-1,2]})

graph = gt.Graph(directed=True)
eprop = graph.new_edge_property("vector<int>")

vprop =
graph.add_edge_list(pdat[['source','target','weight']].values.tolist(),

hashed=True,string_vals=True,eprops=[eprop])

I get the error

TypeError: 'int' object is not iterable

But not when the eprop is <string>

I know I am missing something, but the property map page in the
documentation doesn't elaborate clearly.

--
Sent from:

http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

attachment.html (1.56 KB)

can you also tell me the difference between the two

'vector<int>' and 'int' property types ?

Well...
The first maps each vertex to a vector of ints, i.e. `v => [4, 9, -2, 1]`,
the second maps each vertex to a single int, i.e. `v => 4`.
.~´

attachment.html (1.17 KB)