コード例 #1
0
ファイル: AcyclicTest.php プロジェクト: quangbt2005/vhost-kis
 /**
  *
  * isAcyclic returns true if a graph contains no cycles, false otherwise.
  *
  * @return	boolean	 true iff graph is acyclic
  * @access	public
  */
 function isAcyclic(&$graph)
 {
     // We only test graphs
     if (!is_a($graph, 'Structures_Graph')) {
         return Pear::raiseError('Structures_Graph_Manipulator_AcyclicTest::isAcyclic received an object that is not a Structures_Graph', STRUCTURES_GRAPH_ERROR_GENERIC);
     }
     if (!$graph->isDirected()) {
         return false;
     }
     // Only directed graphs may be acyclic
     return Structures_Graph_Manipulator_AcyclicTest::_isAcyclic($graph);
 }
コード例 #2
0
ファイル: AcyclicTest.php プロジェクト: emma5021/toba
 /**
  *
  * isAcyclic returns true if a graph contains no cycles, false otherwise.
  *
  * @return	boolean	 true iff graph is acyclic
  * @access	public
  */
 function getCycle(&$graph)
 {
     // We only test graphs
     if (!is_a($graph, 'Structures_Graph')) {
         throw new Exception('Structures_Graph_Manipulator_AcyclicTest::isAcyclic received an object that is not a Structures_Graph');
     }
     if (!$graph->isDirected()) {
         return false;
     }
     // Only directed graphs may be acyclic
     return Structures_Graph_Manipulator_AcyclicTest::_isAcyclic($graph, true);
 }