I'm currently using Treelib to generate a tree with node in which, for each fo them, is stored distance from its own parent node.
How can be possible to use rsearch to find path back to root with minimal distances between every node and its paretn?
Each node has a payload data element of this class:
When I generate the Tree from a random field f single point (star) I stored in each of them distance between child and parent.
Now, I want to come back to root using the path composed by step with minimal distance between node and related parents.
How can be done?
I'm currently using Treelib to generate a tree with node in which, for each fo them, is stored distance from its own parent node. How can be possible to use rsearch to find path back to root with minimal distances between every node and its paretn?
Each node has a payload data element of this class:
class Star: def init(self, position, p, hz, adv, civ, dead, life): self.x, self.y = position self.size = 1 self.thickness = 1 self.n_planets = p self.n_planets_HZ = hz self.n_planets_adv = adv self.n_planets_civ = civ self.n_planets_dead = dead self.n_planets_life = life self.spectre = '' self.colour = (100, 100, 100) self.mass = 0 self.radius = 0 self.luminosity = 0 self.position = position self.parent_distance = 0
When I generate the Tree from a random field f single point (star) I stored in each of them distance between child and parent. Now, I want to come back to root using the path composed by step with minimal distance between node and related parents. How can be done?
Thanks,