I want product of the outgoing vertices as product of variables but it gives nonint type erros [closed]

asked 2017-02-01 08:21:37 -0500

Biswajit gravatar image

updated 2017-02-01 13:28:26 -0500

kcrisman gravatar image

nonint error types:

dia = DiGraph({'x0':{'x1':(1, -1),'y1':(1, -1),'x2':(1, -1)},'y2':{'x0':(1, -1),'x1':(1, -1)}})

diaout = dia.neighbors_out('x0');diaout

prod(p for p in diaout)

TypeError: can't multiply sequence by non-int of type 'str'\n"}︡{"done":true}︡
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Biswajit
close date 2017-02-10 08:45:38.828917


Hi Biswajit! (If you are the one I remember from IMSc.) What is your actual goal here? I think the problem is you are trying to multiply a bunch of strings together - that is what diaout will give you - so you would have to make them mathematical variables or something first. What would multiplying strings even mean?

kcrisman gravatar imagekcrisman ( 2017-02-01 13:31:35 -0500 )edit

You can do ' * '.join(diaout) to get a string representing the product. Is that what you want?

John Palmieri gravatar imageJohn Palmieri ( 2017-02-01 17:09:02 -0500 )edit

I see now that this has been answered in sage-combinat-devel: https://groups.google.com/d/msg/sage-...

John Palmieri gravatar imageJohn Palmieri ( 2017-02-01 17:22:27 -0500 )edit