Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Protected Attributes | Private Member Functions | List of all members
ezpTopologicalSort Class Reference

## Public Member Functions
| __construct ( $dependencies=array())
| sort ()

## Protected Attributes
| $nodes = array()

## Private Member Functions
| getRootNodes ()

## Detailed Description

Sorts a series of dependencies in linear order (topological sort).

Definition at line 15 of file ezptopologicalsort.php.

## Constructor & Destructor Documentation

## ◆ __construct()

ezpTopologicalSort::__construct | ( |  | $dependencies = `array()` | ) |

Create a topological sort.

`<?php $topologicalSort = new ezpTopologicalSort( array( 'a' => null, // a has no dependencies 'b' => 'a', // b depends on a 'd' => 'b', // d depends on b 'e' => array( 'd', 'c' ) // e depends on d and c ) ); ?>`

Parameters

  array | $dependencies | Array of dependencies where the keys depends on the values. Values can either be a scalar or an array.

Definition at line 37 of file ezptopologicalsort.php.

References $module, and $modules.

## Member Function Documentation

## ◆ getRootNodes()

ezpTopologicalSort::getRootNodes | ( |  | ) |
| private

Returns a list of node objects that do not have parents.

Returns
  array of node objects

Definition at line 89 of file ezptopologicalsort.php.

References $output.

Referenced by sort().

## ◆ sort()

ezpTopologicalSort::sort | ( |  | ) |

Performs the topological linear ordering.

Returns
  sorted array

Definition at line 56 of file ezptopologicalsort.php.

References $current, and getRootNodes().

## Member Data Documentation

## ◆ $nodes

ezpTopologicalSort::$nodes = array()
| protected

Definition at line 17 of file ezptopologicalsort.php.

The documentation for this class was generated from the following file:

- ezptopologicalsort.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.