# Module: Algorithm

Accessible via `require('@buggyorg/graphtools').Algorithm`

A collection of algorithms that act on the port graph.

Source:
  - algorithm.js, line 1

### Methods

#### (static) topologicalSort(graph) → {Array.<Node>}

Returns a topological sorting of the graph.

##### Parameters:

Name | Type | Description
--- | --- | ---
`graph` | PortGraph | The graph.

Source:
  - algorithm.js, line 27

##### Throws:

If the graph has loops.

Type
  Error

##### Returns:

A sorting of the nodes given as an array of nodes.

Type
  Array.<Node>