# 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 890

##### 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 731

##### 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 650

##### 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 795

##### 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 509

##### 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 949

##### 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 664

##### 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 597

##### 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 564

##### 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 534

##### 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 816

##### 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 829

##### 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 1023

##### 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 1038

##### Returns:

Returns the network vertices labels.

Type
  object

#### (static) getLabels(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 1056

##### Returns:

Matrix with vertex labels set.

Type
  obj

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

Removes the network vertices labels.

##### Parameters:

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

Source:
  - cna.maia, line 1075

##### 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 912

##### Returns:

Returns the number os geodesics in the network.

Type
  number

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

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

##### Parameters:

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

Source:
  - cna.maia, line 746

##### 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 480

##### 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 1000

##### Returns:

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

Type
  object

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

Create a Pajek file from JSON.

##### Parameters:

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

Source:
  - cna.maia, line 409

##### Returns:

A Pajek file.

Type
  object

#### (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 232

##### Returns:

A JSON containing the network.

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