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. |
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). |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
Returns:
Returns the network vertices labels.
- Type
- object
(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. |
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. |
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. |
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. |
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. |
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). |
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. |
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). |
Returns:
An adjascence matrix.
- Type
- object
(static) removeLabels(adj) → {number}
Removes the network vertices labels.
Parameters:
Name | Type | Description |
---|---|---|
adj |
object | Adjascence matrix. |
Returns:
Removes the network vertices labels.
- Type
- number
(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. |
Returns:
Matrix with vertex labels set.
- Type
- obj