Reputation: 35285
Here's the line that throws this error
(x,neighbor) = random.sample(out_edge_list,1)
Upvotes: 1
Views: 1184
Reputation: 35285
Here the solution. I changed the line to
(x,neighbor) = random.sample(out_edge_list,1)[0]
Upvotes: 0
Reputation: 143354
You're asking for 1 unique random element. So you're getting back something like [5]
. If the 5 goes into x
, what goes into neighbor
?
Perhaps you meant to ask for 2 elements?
(x, neighbor) = random.sample(out_edge_list, 2)
Upvotes: 3