/** * Constructor * @param SimpleGraph $oGraph The graph to browse * @param string $sType "Node", "Edge" or null */ public function __construct(SimpleGraph $oGraph, $sType = null) { $this->iCurrentIdx = -1; $this->aList = array(); switch ($sType) { case 'Node': foreach ($oGraph->_GetNodes() as $oNode) { $this->aList[] = $oNode; } break; case 'Edge': foreach ($oGraph->_GetEdges() as $oEdge) { $this->aList[] = $oEdge; } break; default: foreach ($oGraph->_GetNodes() as $oNode) { $this->aList[] = $oNode; } foreach ($oGraph->_GetEdges() as $oEdge) { $this->aList[] = $oEdge; } } }