Subversion Repositories programming

Rev

Rev 391 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 391 Rev 392
Line 65... Line 65...
65
			M = N.get_children()
65
			M = N.get_children()
66
 
66
 
67
			###############################################################
67
			###############################################################
68
			# Add the current place to the result graph
68
			# Add the current place to the result graph
69
			result.add_vertex (str(N))
69
			result.add_vertex (str(N))
-
 
70
 
70
			if not firsttime:
71
			if not firsttime:
71
				v1 = str(N)
72
				v1 = str(N)
72
				v2 = str(self.__find_nearest_child (M, CLOSED))
73
				v2 = str(self.__find_nearest_child (M, CLOSED))
73
 
74
 
74
				result.add_edge (v1, v2)
75
				result.add_edge (v1, v2)
75
				result.set_edge_color (v1, v2, yapgvb.colors.red)
76
				result.set_edge_color (v1, v2, yapgvb.colors.red)
76
				result.set_edge_label (v1, v2, str(counter))
77
				result.set_edge_label (v1, v2, str(counter))
77
 
78
 
-
 
79
				result.set_vertex_value (str(N), result.get_vertex_value(v2)+1)
-
 
80
 
78
			else:
81
			else:
79
				# Set start node shape to be a double circle
82
				# Set start node shape to be a double circle
80
				result.set_vertex_shape (str(N), yapgvb.shapes.doublecircle)
83
				result.set_vertex_shape (str(N), yapgvb.shapes.doublecircle)
-
 
84
				result.set_vertex_value (str(N), 0) # set depth
81
				firsttime = False
85
				firsttime = False
82
			###############################################################
86
			###############################################################
83
 
87
 
84
			# Check if we've reached the goal
88
			# Check if we've reached the goal
85
			if N in self.__goal_nodes:
89
			if N in self.__goal_nodes:
-
 
90
				print '%s nodes created' % (len(OPEN) + len(CLOSED))
-
 
91
				print 'searched to depth: %s' % result.get_vertex_value (str(N))
86
				# Set the goal node's shape to be a diamond
92
				# Set the goal node's shape to be a diamond
87
				result.set_vertex_shape (str(N), yapgvb.shapes.diamond)
93
				result.set_vertex_shape (str(N), yapgvb.shapes.diamond)
88
				return result
94
				return result
89
 
95
 
90
			# Add the children of N (aka M) to OPEN
96
			# Add the children of N (aka M) to OPEN