R6 class defining a directed graph model for representing a network, including methods to calculate various measures from graph theory. The igraph package is used as a backend for calculations.

DirectedGraph

Format

An R6Class generator object

Class Constructor

new(nodes, edges)

  • Instantiate new object of the class.

  • Args:

    • nodes: a data.table containing nodes

    • edges: a data.table containing edges

  • Returns:

    • Object of the class

Public Methods

node_measures(measures = NULL)

  • Return specified node-level measures, calculating if necessary. See Node Measures section below for details about each measure.

  • Args:

    • measures: character vector of measure names. Default NULL will return those that are already calculated.

  • Returns:

    • data.table with specified node meaures as columns

graph_measures(measures = NULL)

  • Return specified graph-level measures, calculating if necessary. See Graph Measures section below for details about each measure.

  • Args:

    • measures: character vector of measure names. Default NULL will return those that are already calculated.

  • Returns:

    • list with specified graph measures

Public Fields

nodes

: node data.table, read-only

edges

: edge data.table, read-only

igraph

: igraph object, read-only

available_node_measures

: character vector of all supported node measures. See Node Measures section below for detailed descriptions. Read-only.

available_graph_measures

: character vector of all supported graph measures. See Graph Measures section below for detailed descriptions. Read-only.

default_node_measures

: character vector of default node measures. See Node Measures section below for detailed descriptions. Read-only.

default_graph_measures

: character vector of default graph measures. See Graph Measures section below for detailed descriptions. Read-only.

Special Methods

clone(deep = FALSE)

  • Method for copying an object. See Advanced R for the intricacies of R6 reference semantics.

  • Args:

    • deep: logical. Whether to recursively clone nested R6 objects.

  • Returns:

    • Cloned object of this class.

print()

  • Print igraph object.

  • Returns:

    • Self

Node Measures

outDegree

: outdegree, the number of outward edges (tail ends). Calculated by igraph::degree. [Wikipedia]

inDegree

: indegree, number of inward edges (head ends). Calculated by igraph::degree. [Wikipedia]

outCloseness

: closeness centrality (out), a measure of path lengths to other nodes along edge directions. Calculated by igraph::closeness. [Wikipedia]

inCloseness

: closeness centrality (in), a measure of path lengths to other nodes in reverse of edge directions. Calculated by igraph::closeness. [Wikipedia]

numRecursiveDeps

: number recursive dependencies, i.e., count of all nodes reachable by following edges out from this node. Calculated by igraph::neighborhood.size. [Wikipedia]

numRecursiveRevDeps

: number of recursive reverse dependencies (dependents), i.e., count all nodes reachable by following edges into this node in reverse direction. Calculated by igraph::neighborhood.size. [Wikipedia]

betweenness

: betweenness centrality, a measure of the number of shortest paths in graph passing through this node Calculated by igraph::betweenness. [Wikipedia]

pageRank

: Google PageRank. Calculated by igraph::page_rank. [Wikipedia]

hubScore

: hub score from Hyperlink-Induced Topic Search (HITS) algorithm. Calculated by igraph::hub_score. [Wikipedia]

authorityScore

: authority score from Hyperlink-Induced Topic Search (HITS) algorithm. Calculated by igraph::authority_score. [Wikipedia]

Graph Measures

graphOutDegree

: graph freeman centralization for outdegree. A measure of the most central node by outdegree in relation to all other nodes. Calculated by igraph::centralize. [Wikipedia]

graphInDegree

: graph Freeman centralization for indegree. A measure of the most central node by indegree in relation to all other nodes. Calculated by igraph::centralize. [Wikipedia]

graphOutClosness

: graph Freeman centralization for out-closeness. A measure of the most central node by out-closeness in relation to all other nodes. Calculated by igraph::centralize. [Wikipedia]

graphInCloseness

: graph Freeman centralization for outdegree. A measure of the most central node by outdegree in relation to all other nodes. Calculated by igraph::centralize. [Wikipedia]

graphBetweennness

: graph Freeman centralization for betweenness A measure of the most central node by betweenness in relation to all other nodes. Calculated by igraph::centralize. [Wikipedia]