Skip to content
Snippets Groups Projects
Verified Commit 6d25f705 authored by quietone's avatar quietone
Browse files

Issue #3200162 by brandonlira, ksenzee, ultimike, larowlan, cecelias, xjm:...

Issue #3200162 by brandonlira, ksenzee, ultimike, larowlan, cecelias, xjm: Improve documentation for Graph component
parent 7caa7cbd
Branches
Tags
3 merge requests!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #481840 passed with warnings
Pipeline: drupal

#481853

    ...@@ -4,6 +4,25 @@ ...@@ -4,6 +4,25 @@
    /** /**
    * Directed acyclic graph manipulation. * Directed acyclic graph manipulation.
    *
    * This class represents a directed acyclic graph (DAG) and provides methods
    * for processing and sorting it.
    *
    * Example of a graph structure:
    * @code
    * 1────►2────►3
    * │ │
    * │ ▼
    * └───► 4
    * @endcode
    *
    * Example of defining a graph in PHP:
    * @code
    * $graph[1]['edges'][2] = 1;
    * $graph[2]['edges'][3] = 1;
    * $graph[2]['edges'][4] = 1;
    * $graph[3]['edges'][4] = 1;
    * @endcode
    */ */
    class Graph { class Graph {
    ...@@ -15,29 +34,14 @@ class Graph { ...@@ -15,29 +34,14 @@ class Graph {
    protected $graph; protected $graph;
    /** /**
    * Instantiates the depth first search object. * Instantiates the directed acyclic graph object.
    * *
    * @param array $graph * @param array $graph
    * A three dimensional associated array, with the first keys being the names * A three-dimensional associative array, with the first keys being the
    * of the vertices, these can be strings or numbers. The second key is * names of the vertices, which can be strings or numbers. The second key is
    * 'edges' and the third one are again vertices, each such key representing * 'edges', whose value is an array keyed by the names of the vertices
    * an edge. Values of array elements are copied over. * connected to it; the values in this array can be simply TRUE or may
    * * contain other data.
    * Example:
    * @code
    * $graph[1]['edges'][2] = 1;
    * $graph[2]['edges'][3] = 1;
    * $graph[2]['edges'][4] = 1;
    * $graph[3]['edges'][4] = 1;
    * @endcode
    *
    * On return you will also have:
    * @code
    * $graph[1]['paths'][2] = 1;
    * $graph[1]['paths'][3] = 1;
    * $graph[2]['reverse_paths'][1] = 1;
    * $graph[3]['reverse_paths'][1] = 1;
    * @endcode
    */ */
    public function __construct($graph) { public function __construct($graph) {
    $this->graph = $graph; $this->graph = $graph;
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment