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

asked 2017-02-01 15:21:37 +0100

Biswajit gravatar image

updated 2017-02-01 20:28:26 +0100

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 15:45:38.828917

Comments

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 20:31:35 +0100 )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-02 00:09:02 +0100 )edit
1

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-02 00:22:27 +0100 )edit