Options
All
  • Public
  • Public/Protected
  • All
Menu

Network.

Weighted nodes and weighted edges are supported. Directed edges are not supported.

Network objects are immutable.

The adjacency matrix of the network is stored in a sparse compressed format.

Hierarchy

  • Network

Index

Properties

nNodes: number

Number of nodes.

nodeWeights: number[]

Node weights.

firstNeighborIndices: number[]

Index of the first neighbor of each node in the neighbors array.

The neighbors of node i are given by neighbors[firstNeighborIndices[i]], ..., neighbors[firstNeighborIndices[i + 1] - 1].

neighbors: number[]

Neighbors of each node.

edgeWeights: number[]

Edge weights.

totalEdgeWeightSelfLinks: number

Total edge weight of self links.

nEdges: number

Number of edges.

Each edge is counted twice, once in each direction.

Constructors

Methods

  • getNNodes(): number
  • Returns the number of nodes.

    Returns number

    Number of nodes

  • getTotalNodeWeight(): number
  • Returns the total node weight.

    Returns number

    Total node weight

  • getNodeWeights(): number[]
  • Returns the weight of each node.

    Returns number[]

    Weight of each node

  • getNodeWeight(node: number): number
  • Returns the weight of a node.

    Parameters

    • node: number

      Node

    Returns number

    Weight

  • getNEdges(): number
  • Returns the number of edges.

    Each edge is counted only once, even though an edge runs in two directions. This means that the number of edges returned by getEdges equals twice the number of edges returned by getNEdges.

    Returns number

    Number of edges

  • getNNeighborsPerNode(): number[]
  • Returns the number of neighbors per node.

    Returns number[]

    Number of neighbors per node

  • getNNeighbors(node: number): number
  • Returns the number of neighbors of a node.

    Parameters

    • node: number

      Node

    Returns number

    Number of neighbors

  • getEdges(): number[][]
  • Returns the list of edges.

    Each edge is included twice, once in each direction. This means that the number of edges returned by getEdges equals twice the number of edges returned by getNEdges.

    The list of edges is returned in a two-dimensional array edges. Edge i connects nodes edges[0][i] and edges[1][i].

    Returns number[][]

    List of edges

  • getNeighborsPerNode(): number[][]
  • Returns a list of neighbors per node.

    Returns number[][]

    List of neighbors per node

  • getNeighbors(node: number): number[]
  • Returns the list of neighbors of a node.

    Parameters

    • node: number

      Node

    Returns number[]

    List of neighbors

  • getTotalEdgeWeightPerNode(): number[]
  • Returns the total edge weight per node. The total edge weight of a node equals the sum of the weights of the edges between the node and its neighbors.

    Returns number[]

    Total edge weight per node

  • getTotalEdgeWeight(node?: number): number
  • Returns the total edge weight.

    Each edge is considered only once, even though an edge runs in two directions. This means that the sum of the edge weights returned by getEdgeWeights equals twice the total edge weight returned by getTotalEdgeWeight.

    Edge weights of self links are not included.

    Parameters

    • Optional node: number

      Node

    Returns number

    Total edge weight

  • getEdgeWeightsPerNode(): number[][]
  • Returns a list of edge weights per node. These are the weights of the edges between a node and its neighbors.

    Returns number[][]

    List of edge weights per node

  • getEdgeWeights(node?: number): number[]
  • Returns the list of edge weights of a node. These are the weights of the edges between the node and its neighbors.

    Parameters

    • Optional node: number

      Node

    Returns number[]

    List of edge weights

  • getTotalEdgeWeightSelfLinks(): number
  • Returns the total edge weight of self links.

    Returns number

    Total edge weight of self links

  • createNetworkWithoutNodeWeights(): Network
  • Creates a copy of the network, but without node weights.

    Each node is assigned a weight of 1.

    Returns Network

    Network without node weights

  • createNetworkWithoutEdgeWeights(): Network
  • Creates a copy of the network, but without edge weights.

    Each edge is assigned a weight of 1.

    Returns Network

    Network without edge weights

  • createNetworkWithoutNodeAndEdgeWeights(): Network
  • Creates a copy of the network, but without node and edge weights.

    Each node is assigned a weight of 1, and each edge is assigned a weight of 1.

    Returns Network

    Network without node and edge weights

  • createNormalizedNetworkUsingAssociationStrength(): Network
  • Creates a copy of the network in which the edge weights have been normalized using the association strength.

    The normalized weight a'[i][j] of the edge between nodes i and j is given by

    a'[i][j] = a[i][j] / (n[i] * n[j] / (2 * m)),
    

    where a[i][j] is the non-normalized weight of the edge between nodes i and j, n[i] is the weight of node i, and m is half the total node weight.

    If each node's weight equals the total weight of the edges between the node and its neighbors, the edge weights are normalized by dividing them by the expected edge weights in the random configuration model.

    The node weights are set to 1.

    Returns Network

    Normalized network

  • createNormalizedNetworkUsingFractionalization(): Network
  • Creates a copy of the network in which the edge weights have been normalized using fractionalization.

    The normalized weight a'[i][j] of the edge between nodes i and j is given by

    a'[i][j] = a[i][j] * (n / n[i] + n / n[j]) / 2,
    

    where a[i][j] is the non-normalized weight of the edge between nodes i and j, n[i] is the weight of node i, and n is the number of nodes.

    The node weights are set to 1.

    Returns Network

    Normalized network

  • Creates a copy of the network that has been pruned in order to have a specified maximum number of edges.

    Only the edges with the highest weights are retained in the pruned network. In case of ties, the edges to be retained are selected randomly.

    Parameters

    • maxNEdges: number

      Maximum number of edges

    • random: Random = ...

      Random number generator

    Returns Network

    Pruned network

  • createSubnetworkForNodes1(nodes: number[]): Network
  • Creates an induced subnetwork for specified nodes.

    Parameters

    • nodes: number[]

      Nodes

    Returns Network

    Subnetwork

  • createSubnetworkForNodes2(nodesInSubnetwork: boolean[]): Network
  • Creates an induced subnetwork for specified nodes.

    Parameters

    • nodesInSubnetwork: boolean[]

      Indicates the nodes to be included in the subnetwork.

    Returns Network

    Subnetwork

  • Creates an induced subnetwork for a specified cluster in a clustering.

    If subnetworks need to be created for all clusters in a clustering, it is more efficient to use createSubnetworks.

    Parameters

    • clustering: Clustering

      Clustering

    • cluster: number

      Cluster

    Returns Network

    Subnetwork

  • Creates induced subnetworks for the clusters in a clustering.

    Parameters

    Returns Network[]

    Subnetworks

  • createSubnetworkLargestComponent(): Network
  • Creates an induced subnetwork of the largest connected component.

    Returns Network

    Subnetwork

  • Creates a reduced (or aggregate) network based on a clustering.

    Each node in the reduced network corresponds to a cluster of nodes in the original network. The weight of a node in the reduced network equals the sum of the weights of the nodes in the corresponding cluster in the original network. The weight of an edge between two nodes in the reduced network equals the sum of the weights of the edges between the nodes in the two corresponding clusters in the original network.

    Parameters

    Returns Network

    Reduced network

  • checkIntegrity(): void
  • Checks the integrity of the network.

    It is checked whether:

    • variables have a correct value,
    • arrays have a correct length,
    • edges are sorted correctly,
    • edges are stored in both directions.

    An exception is thrown if the integrity of the network is violated.

    throws

    An illegal argument was provided in the construction of the network.

    Returns void

  • initializeNetworkBasedOnEdges(nNodes: number, nodeWeights: undefined | number[], setNodeWeightsToTotalEdgeWeights: undefined | boolean, edges: number[][], edgeWeights: undefined | number[], sortedEdges: undefined | boolean, checkIntegrity: undefined | boolean): void
  • Parameters

    • nNodes: number
    • nodeWeights: undefined | number[]
    • setNodeWeightsToTotalEdgeWeights: undefined | boolean
    • edges: number[][]
    • edgeWeights: undefined | number[]
    • sortedEdges: undefined | boolean
    • checkIntegrity: undefined | boolean

    Returns void

  • initializeNetworkBasedOnNeighbors(nNodes: number, nodeWeights: undefined | number[], setNodeWeightsToTotalEdgeWeights: undefined | boolean, firstNeighborIndices: number[], neighbors: number[], edgeWeights: undefined | number[], checkIntegrity: undefined | boolean): void
  • Parameters

    • nNodes: number
    • nodeWeights: undefined | number[]
    • setNodeWeightsToTotalEdgeWeights: undefined | boolean
    • firstNeighborIndices: number[]
    • neighbors: number[]
    • edgeWeights: undefined | number[]
    • checkIntegrity: undefined | boolean

    Returns void

  • getTotalEdgeWeightPerNodeHelper(): number[]
  • getRandomNumber(node1: number, node2: number, randomNumbers: number[]): number
  • Parameters

    • node1: number
    • node2: number
    • randomNumbers: number[]

    Returns number

  • createSubnetwork(clustering: Clustering, cluster: number, nodes: number[], subnetworkNodes: number[], subnetworkNeighbors: number[], subnetworkEdgeWeights: number[]): Network
  • Parameters

    • clustering: Clustering
    • cluster: number
    • nodes: number[]
    • subnetworkNodes: number[]
    • subnetworkNeighbors: number[]
    • subnetworkEdgeWeights: number[]

    Returns Network

  • sortEdges(edges: number[][], edgeWeights?: number[]): void
  • Parameters

    • edges: number[][]
    • Optional edgeWeights: number[]

    Returns void

Generated using TypeDoc