# Namespace: cna

## cna

MaiaScript Social and Complex Network Analysis library.

Source:
  - cna.maia, line 21

### Methods

#### (static) createNetwork(topology, numVertices, numEdges, edgeProbability, averageDegree) → {object}

Creates an artificial network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topology` | string | Graph topology. It can be: complete, random, small world, scale-free or hybrid.
`numVertices` | number | Number of vertices.
`numEdges` | number | Number of edges.
`edgeProbability` | number | Edge probability.
`averageDegree` | number | Average degree.

Source:
  - cna.maia, line 27

##### Returns:

An artificial network.

Type
  object

#### (static) createPajekFile(adj, type) → {string}

Creates a Pajek file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`type` | string | File type (edges, arcs or matrix).

Source:
  - cna.maia, line 46

##### Returns:

A Pajek file.

Type
  string

#### (static) doShortestPathWalk(path, i, j) → {object}

Do a shortest parh walk in the network and returns the path.

##### Parameters:

Name | Type | Description
--- | --- | ---
`path` | object | Paths matrix.
`i` | number | Element index.
`j` | number | Element index.

Source:
  - cna.maia, line 1006

##### Returns:

Returns an array containing the shortest parh walk between two vetice in the matrix.

Type
  object

#### (static) getAverageClustering(clustering) → {number}

Calculates average clustering coefficient of the network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`clustering` | object | Array containing the clustering coefficients of the vertices.

Source:
  - cna.maia, line 798

##### Returns:

Returns the average clustering coefficient of the network.

Type
  number

#### (static) getAverageDegree(degrees) → {number}

Calculates average degree of the network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`degrees` | object | Array containing degrees of the vertices.

Source:
  - cna.maia, line 721

##### Returns:

Returns the average degree of the network.

Type
  number

#### (static) getAverageShortestPath(geodesic) → {number}

Calculates average shortest path of the network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`geodesic` | object | Array the shortest parh between each two vetices in the matrix.

Source:
  - cna.maia, line 911

##### Returns:

Returns the average shortest path of the network.

Type
  number

#### (static) getBooleanOr(a, b) → {object}

Boolean OR between two matrices (A and B).

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | object | Matrix A.
`b` | object | Matrix B.

Source:
  - cna.maia, line 579

##### Returns:

Boolean OR between two matrices.

Type
  object

#### (static) getCentrality(adj, geodesic, directed) → {object}

Returns an array containing the centralities of each pair of the network's vertices.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`geodesic` | object | Vector including the geodesics of the network.
`directed` | boolean | True if the network is directed. False otherwise.

Source:
  - cna.maia, line 1065

##### Returns:

Returns an array containing the centralities of each pair of the network's vertices

Type
  object

#### (static) getClustering(adj, directed) → {object}

Calculates the clustering coefficients of the vertices.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`directed` | boolean | True if the network is directed.

Source:
  - cna.maia, line 735

##### Returns:

Returns an array containing the clustering coefficients of the vertices.

Type
  object

#### (static) getDegreeDistribution(degrees) → {object}

Calculates the degrees distribution in the network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`degrees` | object | Array containing degrees of the vertices.

Source:
  - cna.maia, line 668

##### Returns:

Returns an array containing the degrees distribution in the network.

Type
  object

#### (static) getDegrees(adj, directed) → {object}

Calculates the degrees of the vertices of the matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`directed` | boolean | True if the network is directed.

Source:
  - cna.maia, line 635

##### Returns:

Returns a array containing the degrees of the vertices.

Type
  object

#### (static) getDensity(adj, directed) → {number}

Calculates the network density.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`directed` | boolean | True if the network is directed.

Source:
  - cna.maia, line 605

##### Returns:

The network density.

Type
  number

#### (static) getDiameter(geodesic) → {number}

Calculates the network diameter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`geodesic` | object | Array the shortest parh between each two vetices in the matrix.

Source:
  - cna.maia, line 932

##### Returns:

Returns the network diameter.

Type
  number

#### (static) getFloydWarshallShortestPath(adj, path) → {object}

Calculates the shortest parh between each two vetices in the matrix using Floyd Warshall method.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`path` | object | Matrix to store paths.

Source:
  - cna.maia, line 945

##### Returns:

Returns an array containing the shortest parh between each two vetice in the matrix.

Type
  object

#### (static) getGlobalEfficiency(efficiency) → {number}

Returns the network's global efficiency.

##### Parameters:

Name | Type | Description
--- | --- | ---
`efficiency` | object | Array containing the vertex efficiency of each vertex of the network.

Source:
  - cna.maia, line 1139

##### Returns:

Returns the network's global efficiency.

Type
  number

#### (static) getLabels(adj) → {object}

Returns the network vertices labels.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.

Source:
  - cna.maia, line 1154

##### Returns:

Returns the network vertices labels.

Type
  object

#### (static) getLabels(adj) → {number}

Removes the network vertices labels.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.

Source:
  - cna.maia, line 1191

##### Returns:

Removes the network vertices labels.

Type
  number

#### (static) getNumberOfGeodesics(adj, geodesic, directed) → {number}

Return the number os geodesics in the network.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`geodesic` | object | Vector including the geodesics of the network.
`directed` | boolean | True if the network is directed. False otherwise.

Source:
  - cna.maia, line 1028

##### Returns:

Returns the number os geodesics in the network.

Type
  number

#### (static) getShortestPath(adj, useGPU) → {object}

Calculates the shortest parh between each two vetices in the matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`useGPU` | boolean | Uses the GPU to speed up calculations.

Source:
  - cna.maia, line 813

##### Returns:

Returns an array containing the shortest parh between each two vetice in the matrix.

Type
  object

#### (static) getTransitiveClosure(a, b) → {object}

Transitive closure between two matrices (A and B).

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | object | Matrix A.
`b` | object | Matrix B.

Source:
  - cna.maia, line 549

##### Returns:

Transitive closure between two matrices.

Type
  object

#### (static) getVertexEfficiency(geodesic) → {object}

Returns an array containing the vertex efficiency of each pair of the network's vertices.

##### Parameters:

Name | Type | Description
--- | --- | ---
`geodesic` | object | Vector including the geodesics of the network.

Source:
  - cna.maia, line 1116

##### Returns:

Returns an array containing the vertex efficiency of each pair of the network's vertices

Type
  object

#### (static) jsonToPajekFile(network) → {string}

Create a Pajek file from JSON.

##### Parameters:

Name | Type | Description
--- | --- | ---
`network` | object | JSON containing the network.

Source:
  - cna.maia, line 478

##### Returns:

A Pajek file.

Type
  string

#### (static) pajekFileToJson(fileContents, properties) → {object}

Convert a file in Pajek format to JSON.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fileContents` | string | Pajek file contents.
`properties` | object | Network properties (n, m and directed).

Source:
  - cna.maia, line 297

##### Returns:

A JSON containing the network.

Type
  object

#### (static) parseMatrixFile(fileContents, properties, char, replaceCommas) → {object}

Parses a CSV matrix file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fileContents` | string | Pajek file contents.
`properties` | object | Network properties (n, m and directed).
`char` | string | The separator character.
`replaceCommas` | boolean | Replace commas by dots in edges weights.

Source:
  - cna.maia, line 232

##### Returns:

An adjascence matrix.

Type
  object

#### (static) parsePajekFile(fileContents, properties) → {object}

Parses a Pajek file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`fileContents` | string | Pajek file contents.
`properties` | object | Network properties (n, m and directed).

Source:
  - cna.maia, line 102

##### Returns:

An adjascence matrix.

Type
  object

#### (static) setLabels(adj, labels) → {obj}

Sets the network vertices labels.

##### Parameters:

Name | Type | Description
--- | --- | ---
`adj` | object | Adjascence matrix.
`labels` | object | Array containing the vertices labels.

Source:
  - cna.maia, line 1172

##### Returns:

Matrix with vertex labels set.

Type
  obj