Basically, I have a 300 by 250 area that I want to randomly move about. However, there are areas of interest at points 18750 and 9300 (you can figure out x,y by doing y = 0 while(num > x): num = num - x y += 1
and you'll get the coordinates). Anyway, so if the starting point is (0,0), I want to be able to randomly move about the area but kind of move in the general area of the two given points. Maybe one has a stronger pull so even if the node traversal leads to the weaker one, it will, with enough time, end up at the one with stronger pull.
So far, I have this in order to create my graph and create my vertices and edges. It gives me a 300x250 space with each node connected vertically and horizontally. `
from igraph import *
g = Graph()
x = 300
y = 250
g.add_vertices(x*y)
li = []
for i in range(x-1):
for j in range(y):
li.append((i+j*x, i+1+j*x))
for i in range(x):
for j in range(y-1):
li.append((i+j*x, i+x+j*x))
g.add_edges(li)
gravity_points = [18750, 9300]
final_point = 24900
` How can I go about this? I want to have the traveling node have to make a choice at every resting node but the probability of it traveling in any direction being completely dependent on the weights of the gravity points. So it might have a 10% chance to go left, a 10% chance to go right, a 50% chance to go down and a 30% chance to go up. Something like that. The probabilities don't have to change with proximity but rather with the direction the gravity points are in.
Any help is welcome!! Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire