?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
|
// +-----------------------------------------------------------------------------+
//
/**
* The Graph.php file contains the definition of the Structures_Graph class
*
* @see Structures_Graph
* @package Structures_Graph
*/
/* dependencies {{{ */
/** PEAR base classes */
require_once 'PEAR.php';
/** Graph Node */
require_once 'Structures/Graph/Node.php';
/* }}} */
define('STRUCTURES_GRAPH_ERROR_GENERIC', 100);
/* class Structures_Graph {{{ */
/**
* The Structures_Graph class represents a graph data structure.
*
* A Graph is a data structure composed by a set of nodes, connected by arcs.
* Graphs may either be directed or undirected. In a directed graph, arcs are
* directional, and can be traveled only one way. In an undirected graph, arcs
* are bidirectional, and can be traveled both ways.
*
* @author Sérgio Carvalho
* @copyright (c) 2004 by Sérgio Carvalho
* @package Structures_Graph
*/
/* }}} */
class Structures_Graph {
/* fields {{{ */
/**
* @access private
*/
var $_nodes = array();
/**
* @access private
*/
var $_directed = false;
/* }}} */
/* Constructor {{{ */
/**
*
* Constructor
*
* @param boolean Set to true if the graph is directed. Set to false if it is not directed. (Optional, defaults to true)
* @access public
*/
function Structures_Graph($directed = true) {
$this->_directed = $directed;
}
/* }}} */
/* isDirected {{{ */
/**
*
* Return true if a graph is directed
*
* @return boolean true if the graph is directed
* @access public
*/
function isDirected() {
return (boolean) $this->_directed;
}
/* }}} */
/* addNode {{{ */
/**
*
* Add a Node to the Graph
*
* @param Structures_Graph_Node The node to be added.
* @access public
*/
function addNode(&$newNode) {
// We only add nodes
if (!is_a($newNode, 'Structures_Graph_Node')) return Pear::raiseError('Structures_Graph::addNode received an object that is not a Structures_Graph_Node', STRUCTURES_GRAPH_ERROR_GENERIC);
// Graphs are node *sets*, so duplicates are forbidden. We allow nodes that are exactly equal, but disallow equal references.
foreach($this->_nodes as $key => $node) {
/*
ZE1 equality operators choke on the recursive cycle introduced by the _graph field in the Node object.
So, we'll check references the hard way (change $this->_nodes[$key] and check if the change reflects in
$node)
*/
$savedData = $this->_nodes[$key];
$referenceIsEqualFlag = false;
$this->_nodes[$key] = true;
if ($node === true) {
$this->_nodes[$key] = false;
if ($node === false) $referenceIsEqualFlag = true;
}
$this->_nodes[$key] = $savedData;
if ($referenceIsEqualFlag) return Pear::raiseError('Structures_Graph::addNode received an object that is a duplicate for this dataset', STRUCTURES_GRAPH_ERROR_GENERIC);
}
$this->_nodes[] =& $newNode;
$newNode->setGraph($this);
}
/* }}} */
/* removeNode (unimplemented) {{{ */
/**
*
* Remove a Node from the Graph
*
* @todo This is unimplemented
* @param Structures_Graph_Node The node to be removed from the graph
* @access public
*/
function removeNode(&$node) {
}
/* }}} */
/* getNodes {{{ */
/**
*
* Return the node set, in no particular order. For ordered node sets, use a Graph Manipulator insted.
*
* @access public
* @see Structures_Graph_Manipulator_TopologicalSorter
* @return array The set of nodes in this graph
*/
function &getNodes() {
return $this->_nodes;
}
/* }}} */
}
?>