@@ -40,18 +40,20 @@ class euclidean:
4040 3. The C{optimize()} method should be called before the heuristic search.
4141
4242 A small example for clarification:
43-
43+ >>> from pygraph.classes import graph
4444 >>> g = graph.graph()
4545 >>> g.add_nodes(['A','B','C'])
4646 >>> g.add_node_attribute('A', ('position',(0,0)))
4747 >>> g.add_node_attribute('B', ('position',(1,1)))
4848 >>> g.add_node_attribute('C', ('position',(0,2)))
49- >>> g.add_edge('A','B', wt=2)
50- >>> g.add_edge('B','C', wt=2)
51- >>> g.add_edge('A','C', wt=4)
52- >>> h = graph.heuristics. euclidean()
49+ >>> g.add_edge(( 'A','B') , wt=2)
50+ >>> g.add_edge(( 'B','C') , wt=2)
51+ >>> g.add_edge(( 'A','C') , wt=4)
52+ >>> h = euclidean()
5353 >>> h.optimize(g)
54- >>> g.heuristic_search('A', 'C', h)
54+ >>> from pygraph.algorithms.minmax import heuristic_search
55+ >>> heuristic_search(g, 'A', 'C', h)
56+ ['A', 'C']
5557 """
5658
5759 def __init__ (self ):
@@ -92,7 +94,7 @@ def __call__(self, start, end):
9294 @type end: node
9395 @param end: End node.
9496 """
95- assert len (list ( self .distances .keys () )) > 0 , (
97+ assert len (self .distances .keys ()) > 0 , (
9698 "You need to optimize this heuristic for your graph before it can be used to estimate."
9799 )
98100
0 commit comments