src/ADT/Graph/DirectedWeighted.php
public function getPath( $source, $target, $stack = false )
	{
		if( $this->isEdge( $source, $target ) )
		{
			if( $stack && is_a( $stack, "stack" ) )
				$way = $stack;
			else $way = new ADT_List_Stack();
			$way->push( $target );
			return $way;
		}
		$nodes = $this->getTargetNodes( $source );
		foreach( $nodes as $node )
		{
			$way = $this->getPath( $node, $target, $stack );
			if( $way )
			{
				$way->push( $node );
				return $way;
			}
		}
		return false;
	}
public function getPath( $source, $target, $stack = false )
	{
		if( $this->isEdge( $source, $target ) )
		{
			if( $stack && is_a( $stack, "stack" ) )
				$way = $stack;
			else $way = new ADT_List_Stack();
			$way->push( $target );
			return $way;
		}
		$nodes = $this->getTargetNodes( $source );
		foreach( $nodes as $node )
		{
			$way = $this->getPath( $node, $target, $stack );
			if( $way )
			{
				$way->push( $node );
				return $way;
			}
		}
		return false;
	}
public function getPath ( $ source , $ target , $ stack = false ) { if ( $ this -> isEdge ( $ source , $ target ) ) { if ( $ stack && is_a ( $ stack , "stack" ) ) $ way = $ stack ; else $ way = new ADT_List_Stack ( ) ; $ way -> push ( $ target ) ; return $ way ; } $ nodes = $ this -> getTargetNodes ( $ source ) ; foreach ( $ nodes as $ node ) { $ way = $ this -> getPath ( $ node , $ target , $ stack ) ; if ( $ way ) { $ way -> push ( $ node ) ; return $ way ; } } return false ; }
Returns the way between two Nodes as Stack.
@access		public
@param			ADT_Graph_Node		$source		Source Node of this Edge
@param			ADT_Graph_Node		$target		Target Node of this Edge
@param			ADT_List_Stack		$stack		Stack to fill with Node on the way
@return		ADT_List_Stack
Returns the way between two Nodes as Stack .