Package 'L1centrality'

Title: Graph/Network Analysis Based on L1 Centrality
Description: Analyze graph/network data using L1 centrality and prestige. Functions for deriving global, local, and group L1 centrality/prestige are provided. Routines for visual inspection of a graph/network are also provided. Details are in Kang and Oh (2024a) <doi:10.48550/arXiv.2404.13233> and Kang and Oh (2024b) <doi:10.48550/arXiv.2408.12078>.
Authors: Seungwoo Kang [aut, cre] , Hee-Seok Oh [aut]
Maintainer: Seungwoo Kang <[email protected]>
License: GPL (>= 3)
Version: 0.3.1
Built: 2025-02-07 02:40:26 UTC
Source: https://github.com/seungwoo-stat/l1centrality

Help Index


Group Reduced Graph

Description

Computes the vertex multiplicities (weights) and the distance matrix of the group reduced graph. The group reduced graph is constructed by replacing a group of vertices in the original graph by a single ‘pseudo-vertex’.

Usage

group_reduce(g, nodes, eta, method)

## S3 method for class 'igraph'
group_reduce(g, nodes, eta = NULL, method = c("minimum", "maximum", "average"))

## S3 method for class 'matrix'
group_reduce(g, nodes, eta = NULL, method = "minimum")

Arguments

g

An igraph graph object or a distance matrix. Here, the (i,j) component of the distance matrix is the geodesic distance from the ith vertex to the jth vertex.

nodes

A vector of integers. Each integer indicates the index of the vertex.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

method

A character string. It specifies the method of setting the edge weight between the pseudo-vertex and the other vertices. Note that the S3 method for the matrix class only supports the minimum option. This is because it is not possible to derive the group reduced graph's distance matrix from the original distance matrix when using the maximum or average method. On the other hand, the group reduced graph's distance matrix can be derived from the original distance matrix when the minimum method is used. See the discussion in Kang (2025).

  • minimum (the default): the minimum method is used in setting the edge weights.

  • maximum: the maximum method is used in setting the edge weights.

  • average: the average method is used in setting the edge weights.

Details

The group reduced graph is constructed by replacing the vertices indicated in the argument nodes with a single ‘pseudo-vertex’. The multiplicity (weight) of this new vertex is set to the sum of the multiplicities of the vertices within nodes. An edge from the pseudo-vertex to any vertex that is not in nodes, say v, is created in the group reduced graph if there is at least one edge from the vertices in nodes to v in the original graph. The weight of this newly added edge is determined using one of the following methods:

  • Minimum method: The edge weight from the pseudo-vertex to v is set to the minimum of the edge weights of the edges between the vertices in nodes to v in the original graph.

  • Maximum method: The edge weight from the pseudo-vertex to v is set to the maximum of the edge weights of the edges between the vertices in nodes to v in the original graph.

  • Average method: The edge weight from the pseudo-vertex to v is set to the average of the edge weights of the edges between the vertices in nodes to v in the original graph.

An edge from v to the pseudo-vertex is set in a similar manner. For details, refer to Kang (2025).

Value

A list consisting of three objects:

  • ‘distmat’: A matrix representing the group reduced graph's distance matrix, where the first row and column correspond to the pseudo-vertex.

  • ‘eta’: A vector of the group reduced graph's vertex multiplicity. The first element corresponds to the pseudo-vertex.

  • ‘label’: A vector of the vertex names specified by nodes.

Note

Multiple edges (edges with the same head and tail vertices) are not allowed, because they make the edge weight setting procedure confusing.

References

S. Kang. Topics in Non-Euclidean Dimension Reduction. PhD thesis, Seoul National University, 2025.

See Also

L1cent() for L1 centrality/prestige. L1centGROUP() internally uses group_reduce().

Examples

# Group reduced graph of the 'Iron Man' series using the minimum method
vertex_weight <- igraph::V(MCUmovie)$worldwidegross
ironman_series <- c(1,3,7)
reduced_graph <- group_reduce(MCUmovie, nodes = ironman_series, eta = vertex_weight)
reduced_graph$distmat[1:3,1:3]
reduced_graph$label

# Multiplicity of the pseudo-vertex equals the sums of the replaced vertices' multiplicities
reduced_graph$eta[1] == sum(vertex_weight[ironman_series])

Lorenz Curve and the Gini Coefficient

Description

Draws a Lorenz curve (the group heterogeneity plot) and computes the Gini coefficient (the group heterogeneity index).

Usage

Lorenz_plot(x, add = FALSE, ...)

Gini(x)

Arguments

x

A numeric vector.

add

A logical value.

  • TRUE: add the Lorenz curve to an already existing plot.

  • FALSE (the default): draw the Lorenz curve to a new graphic device.

...

Further graphical parameters supplied to the internal base::plot() (when add = FALSE) or graphics::lines() (when add = TRUE) function. See graphics::par() document.

Value

Lorenz_plot() draws a Lorenz curve (the group heterogeneity plot) and returns an invisible copy of a Gini coefficient (the group heterogeneity index).

Gini() returns a Gini coefficient.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.

M. O. Lorenz. Methods of measuring the concentration of wealth. Publications of the American Statistical Association, 9(70):209–219, 1905.

See Also

Use the function with L1cent() or L1centLOC(), and compare distributions of the centrality measurements across several groups and graphs. Summary methods in this package come with the Gini coefficient.

Examples

vertex_weight <- igraph::V(MCUmovie)$worldwidegross
cent <- L1cent(MCUmovie, eta=vertex_weight)
gini <- Lorenz_plot(cent, asp=1)
graphics::abline(0,1,lty=2)
# group heterogeneity index
gini
gini == Gini(cent)

L1 Centrality/Prestige

Description

Computes L1 centrality or L1 prestige for each vertex. The L1 centrality/prestige is a graph centrality/prestige measure defined for the vertices of a graph. It is (roughly) defined by (1 - minimum multiplicity required for a selected vertex to become the median of the graph). For directed graphs, L1 centrality quantifies the prominence of a vertex in making a choice and L1 prestige quantifies the prominence of a vertex in receiving a choice. For undirected graphs, the two measures are identical.

Usage

L1cent(g, eta, mode)

## S3 method for class 'igraph'
L1cent(g, eta = NULL, mode = c("centrality", "prestige"))

## S3 method for class 'matrix'
L1cent(g, eta = NULL, mode = c("centrality", "prestige"))

## S3 method for class 'L1cent'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be connected. For a directed graph, it must be strongly connected. Equivalently, all entries of the distance matrix must be finite. Here, the (i,j) component of the distance matrix is the geodesic distance from the ith vertex to the jth vertex.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

mode

A character string. For an undirected graph, either choice gives the same result.

  • centrality (the default): L1 centrality (prominence of each vertex in terms of making a choice) is used for analysis.

  • prestige: L1 prestige (prominence of each vertex in terms of receiving a choice) is used for analysis.

x

An L1cent object, obtained as a result of the function L1cent().

...

Further arguments passed to or from other methods. This argument is ignored here.

Details

Suppose that g is a (strongly) connected graph consisting of n vertices v1, ..., vn whose multiplicities (weights) are η1,,ηn0\eta_1,\dots,\eta_n \geq 0, respectively, and η=k=1nηk>0\eta_{\cdot} = \sum_{k=1}^n \eta_k > 0.

The centrality median vertex of this graph is the node minimizing the weighted sum of distances. That is, vi is the centrality median vertex if

k=1nηkd(vi,vk)\sum_{k=1}^{n} \eta_k d(v_i, v_k)

is minimized, where d(vi,vk)d(v_i,v_k) denotes the geodesic (shortest path) distance from viv_i to vkv_k. See igraph::distances() for algorithms for computing geodesic distances between vertices. When the indices are swapped to d(vk,vi)d(v_k, v_i) in the display above, we call the node minimizing the weighted sum as the prestige median vertex. When the graph is undirected, the prestige median vertex and the centrality median vertex coincide, and we call it the graph median, following Hakimi (1964).

The L1 centrality for an arbitrary node vi is defined as ‘one minus the minimum weight that is required to make it a centrality median vertex.’ This concept of centrality is closely related to the data depth for ranking multivariate data, as defined in Vardi and Zhang (2000). It turns out that the following formula computes the L1 centrality for the vertex vi:

1S(g)maxji{k=1nηk(d(vi,vk)d(vj,vk))ηd(vj,vi)}+,1-\mathcal{S}(\texttt{g})\max_{j\neq i}\left\{\frac{\sum_{k=1}^{n}\eta_k (d(v_i,v_k) - d(v_j,v_k)) }{\eta_{\cdot}d(v_j,v_i)}\right\}^{+},

where {}+=max(,0)\{\cdot\}^{+}=\max(\cdot,0) and S(g)=minijd(vi,vj)/d(vj,vi)\mathcal{S}(\texttt{g}) = \min_{i\neq j} d(v_i,v_j)/d(v_j,v_i). The L1 centrality of a vertex is in [0,1][0,1] by the triangle inequality, and the centrality median vertex has centrality 1. The L1 prestige is defined analogously, with the indices inside the distance function swapped.

For an undirected graph, S(g)=1\mathcal{S}(\texttt{g}) = 1 since the distance function is symmetric. Moreover, L1 centrality and L1 prestige measures concide.

For details, refer to Kang and Oh (2024a) for undirected graphs, and Kang and Oh (2024b) for directed graphs.

Value

L1cent() returns an object of class L1cent. It is a numeric vector whose length is equivalent to the number of vertices in the graph g. Each component of the vector is the L1 centrality (if mode = "centrality") or the L1 prestige (if mode = "prestige") of each vertex in the given graph.

print.L1cent() prints L1 centrality or L1 prestige values and returns them invisibly.

Note

The function is valid only for connected graphs. If the graph is directed, it must be strongly connected.

References

S. L. Hakimi. Optimum locations of switching centers and the absolute centers and medians of a graph. Operations Research, 12(3):450–459, 1964.

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024a.

S. Kang and H.-S. Oh. L1 prominence measures for directed graphs. arXiv preprint arXiv:2408.12078, 2024b.

Y. Vardi and C.-H. Zhang. The multivariate L1-median and associated data depth. Proceedings of the National Academy of Sciences, 97(4):1423–1426, 2000.

See Also

L1centLOC(), L1centNB(), L1centMDS(), L1centEDGE(), L1centGROUP() for L1 centrality- or prestige-based analysis. See L1centrality-package for each function's support range.

igraph::betweenness(), igraph::closeness(), igraph::degree(), igraph::eigen_centrality() for centrality measures.

Summary for a relevant summary method and Heterogeneity for drawing the Lorenz curve and computing the Gini coefficient.

Examples

# igraph object and distance matrix as an input lead to the same result
vertex_weight <- igraph::V(MCUmovie)$worldwidegross
cent_igraph <- L1cent(MCUmovie, eta=vertex_weight)
cent_matrix <- L1cent(igraph::distances(MCUmovie), eta=vertex_weight)
all(cent_igraph == cent_matrix)

# Top 6 vertices with the highest L1 centrality
utils::head(sort(cent_igraph, decreasing = TRUE))

Multiscale Edge Representation

Description

Derives a multiscale edge representation. Each vertex is connected to its local median, which is found in its L1 centrality-based neighborhood.

Usage

L1centEDGE(g, eta, alpha)

## S3 method for class 'igraph'
L1centEDGE(g, eta = NULL, alpha)

## S3 method for class 'matrix'
L1centEDGE(g, eta = NULL, alpha)

## S3 method for class 'L1centEDGE'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be undirected and connected. Equivalently, the distance matrix must be symmetric, and all entries must be finite.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

alpha

A number or a numeric vector of locality levels. Values must be between 0 and 1.

x

An L1centEDGE object, obtained as a result of the function L1centEDGE().

...

Further arguments passed to or from other methods. This argument is ignored here.

Details

In a global perspective, any given undirected graph can be represented as a star-shaped directed graph, with each vertex making a connection to the median vertex. Based on this idea, an undirected graph can be represented as a directed graph, with each vertex making a connection to the local median vertex. The local median vertex of, say, viv_i, is defined as a median vertex among the L1 centrality-based neighborhood of viv_i. By varying the level of locality, the given graph can be visually inspected at multiple scales. Refer to Kang and Oh (2024) for details.

Value

L1centEDGE() returns an object of class L1centEDGE. It is a list of ‘edge lists’. The length of the list is equivalent to the length of alpha, and the names of the list are the values of alpha. The ith component of the list is a 2-column matrix, and each row defines one directed edge, i.e., it is an edge list. The second column is the local (level alpha[i]) median of the vertex at the first column. There may be more than one edge from each vertex, since there may be more than one local median.

print.L1centEDGE() prints the edge lists and returns them invisibly.

Note

The function is valid only for undirected and connected graphs.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.

See Also

L1cent(), L1centNB(), L1centLOC(). Using the output, one can use igraph::graph_from_edgelist() for creating an igraph object. See the example code below.

Summary for a relevant summary method.

Examples

library(igraph)
MCU_edge <- L1centEDGE(MCUmovie, eta = V(MCUmovie)$worldwidegross, alpha = 5/32)
graph <- graph_from_edgelist(MCU_edge[[1]], directed = TRUE)
plot(graph)

Group L1 Centrality/Prestige

Description

Computes group L1 centrality or group L1 prestige for the specified group of vertices. For undirected graphs, the two measures are identical.

Usage

L1centGROUP(g, nodes, eta, mode, method)

## S3 method for class 'igraph'
L1centGROUP(
  g,
  nodes,
  eta = NULL,
  mode = c("centrality", "prestige"),
  method = c("minimum", "maximum", "average")
)

## S3 method for class 'matrix'
L1centGROUP(
  g,
  nodes,
  eta = NULL,
  mode = c("centrality", "prestige"),
  method = "minimum"
)

## S3 method for class 'L1centGROUP'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be connected. For a directed graph, it must be strongly connected. Equivalently, all entries of the distance matrix must be finite. Here, the (i,j) component of the distance matrix is the geodesic distance from the ith vertex to the jth vertex.

nodes

A vector of integers. Each integer indicates the index of the vertex.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

mode

A character string. For an undirected graph, either choice gives the same result.

  • centrality (the default): L1 centrality (prominence of each vertex in terms of making a choice) is used for analysis.

  • prestige: L1 prestige (prominence of each vertex in terms of receiving a choice) is used for analysis.

method

A character string. It specifies the method of setting the edge weight between the pseudo-vertex and the other vertices. Note that the S3 method for the matrix class only supports the minimum option. This is because it is not possible to derive the group reduced graph's distance matrix from the original distance matrix when using the maximum or average method. On the other hand, the group reduced graph's distance matrix can be derived from the original distance matrix when the minimum method is used. See the discussion in Kang (2025).

  • minimum (the default): the minimum method is used in setting the edge weights.

  • maximum: the maximum method is used in setting the edge weights.

  • average: the average method is used in setting the edge weights.

x

An L1centGROUP object, obtained as a result of the function L1centGROUP().

...

Further arguments passed to or from other methods. This argument is ignored here.

Details

Given a group of vertices on a graph, we first construct a group reduced graph by replacing the group of vertices by a single ‘pseudo-vertex’ (see group_reduce() for the method of setting vertex multiplicities and edge weights in the group reduced graph). The group L1 centrality (prestige) of this group is defined as the L1 centrality (prestige) of the pseudo-vertex in the group reduced graph.

Value

L1centGROUP() returns an object of class L1centGROUP. It is a numeric value of the group L1 centrality (if mode = "centrality") or the group L1 prestige (if mode = "prestige") of the specified group of vertices.

print.L1centGROUP() prints group L1 centrality or group L1 prestige value and returns it invisibly.

Note

The function is valid only for connected graphs. If the graph is directed, it must be strongly connected. Multiple edges (edges with the same head and tail vertices) are not allowed, because they make the edge weight setting procedure confusing.

References

S. Kang. Topics in Non-Euclidean Dimension Reduction. PhD thesis, Seoul National University, 2025.

See Also

L1cent() for L1 centrality/prestige, group_reduce() for details on the minimum, maximum, and average methods.

Examples

# Group L1 centrality of the 'Spider-Man' series
vertex_weight <- igraph::V(MCUmovie)$worldwidegross
L1centGROUP(MCUmovie, nodes = c(16,23,27), eta = vertex_weight)

Local L1 Centrality/Prestige

Description

Computes local L1 centrality or local L1 prestige at each alpha level for every vertex. For undirected graphs, the two measures are identical.

Usage

L1centLOC(g, eta, alpha, mode)

## S3 method for class 'igraph'
L1centLOC(g, eta = NULL, alpha, mode = c("centrality", "prestige"))

## S3 method for class 'matrix'
L1centLOC(g, eta = NULL, alpha, mode = c("centrality", "prestige"))

## S3 method for class 'L1centLOC'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be connected. For a directed graph, it must be strongly connected. Equivalently, all entries of the distance matrix must be finite. Here, the (i,j) component of the distance matrix is the geodesic distance from the ith vertex to the jth vertex.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

alpha

A number or a numeric vector of locality levels. Values must be between 0 and 1.

mode

A character string. For an undirected graph, either choice gives the same result.

  • centrality (the default): L1 centrality (prominence of each vertex in terms of making a choice) is used for analysis.

  • prestige: L1 prestige (prominence of each vertex in terms of receiving a choice) is used for analysis.

x

An L1centLOC object, obtained as a result of the function L1centLOC().

...

Further arguments passed to or from other methods. This argument is ignored here.

Details

Suppose that the given graph has n vertices. We choose about nαn\alpha vertices (L1 centrality- or L1 prestige-based neighborhood) for each vertex (see L1centNB()), and compute the L1 centrality or L1 prestige of the vertex conditioned on these vertices, i.e., derive the L1 centrality or L1 prestige locally. For details, refer to Kang and Oh (2024a) for undirected graphs, and Kang and Oh (2024b) for directed graphs.

Value

L1centLOC() returns an object of class L1centLOC. It is a list of numeric vectors. The length of the list is equivalent to the length of alpha, and the names of the list are the values of alpha. Each component of the list is a numeric vector whose length is equivalent to the number of vertices in the graph g. Specifically, the ith component of the list is a vector of local L1 centrality at level alpha[i] for each vertex (if mode = "centrality") or local L1 prestige at level alpha[i] for each vertex (if mode = "prestige").

print.L1centLOC() prints local L1 centrality or local L1 prestige values at each locality level alpha and returns them invisibly.

Note

The function is valid only for connected graphs. If the graph is directed, it must be strongly connected.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024a.

S. Kang and H.-S. Oh. L1 prominence measures for directed graphs. arXiv preprint arXiv:2408.12078, 2024b.

See Also

L1cent() for L1 centrality/prestige, L1centNB() for L1 centrality/prestige-based neighborhood.

Summary for a relevant summary method.

Examples

weight <- igraph::V(MCUmovie)$worldwidegross
MCUmovie_cent <- L1cent(MCUmovie, eta = weight)
MCUmovie_loc_cent <- L1centLOC(MCUmovie, eta = weight, alpha = 5/32)
plot(MCUmovie_cent, MCUmovie_loc_cent[[1]],
     xlab="Global L1 centrality", ylab="Local L1 centrality (alpha = 5/32)",
     main="MCU movie network: global vs. local centrality")
graphics::text(MCUmovie_cent, MCUmovie_loc_cent[[1]], igraph::V(MCUmovie)$name)

Fitting a Target Plot

Description

L1centMDS() and plot.L1centMDS() are used together to draw a target plot, which is a target-shaped 2D plot that aids in the visual inspection of an undirected graph using the L1 centrality. See Kang and Oh (2024) for a formal definition of a target plot.

Usage

L1centMDS(g, tol, maxiter, verbose)

## S3 method for class 'igraph'
L1centMDS(g, tol = 1e-05, maxiter = 1000, verbose = TRUE)

## S3 method for class 'matrix'
L1centMDS(g, tol = 1e-05, maxiter = 1000, verbose = TRUE)

## S3 method for class 'L1centMDS'
plot(x, zoom = 1, main = NULL, ...)

## S3 method for class 'L1centMDS'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be undirected and connected. Equivalently, the distance matrix must be symmetric, and all entries must be finite.

tol

A numerical tolerance. The gradient descent method terminates if the relative magnitude of the gradient falls below tol as in Kruskal (1964b). By default set to 10-5.

maxiter

A number of maximum iteration allowances for the gradient descent algorithm. By default set to 1000.

verbose

A boolean.

  • TRUE (the default): for each iteration, prints (1) current number of iterations, (2) current stress, and (3) relative magnitude of the gradient to the console. At the end, the final message is printed to the console; total number of iterations and final stress.

  • FALSE: suppress message to the console.

x

An L1centMDS object, obtained as a result of the function L1centMDS().

zoom

A numerical value on how much to zoom-in the plot. By default set to 1 (no zoom).

main

Title of the plot. If set to NULL (the default), the title prints “Target plot / Stress = X”.

...

Further arguments passed to or from other methods.

  • plot() method: Further graphical parameters supplied to the internal base::plot() (for points) and graphics::text() (for labels) function. See graphics::par() document. To supply an argument to the former one, use the prefix ‘plot.’ and for the latter, ‘text.’. For instance, plot.cex = 1 sets the size of the point, whereas text.cex = 1 sets the size of the label.

  • print() method: This argument is ignored.

Details

Denoting the L1 centrality of vertex ii as ci(0,1]c_i\in(0,1], a point representing that vertex is placed on a concentric circle with radius ri=log(ci)r_i = -\log(c_i). Representing each vertex as (ri,θi)(r_i, \theta_i) (in circular coordinates), the values of θi\theta_i are derived using nonmetric multidimensional scaling proposed in Kruskal (1964a,b). The initial configuration is derived using classical multidimensional scaling (stats::cmdscale()). A gradient descent algorithm is employed in deriving optimal θi\theta_is.

Value

L1centMDS() returns an object of class L1centMDS. It is a list consisting of three vectors:

  • ‘radius’: Radius of a point representing each vertex in the target plot's circular coordinate system, i.e., log(L1 centrality)-\log(L_1\text{ centrality}) for each vertex.

  • ‘theta’: Angle (in radians) of a point representing each vertex in the target plot's circular coordinate system.

  • ‘stress’: Stress measure defined in Kruskal (1964a).

plot.L1centMDS() draws a target plot. Four concentric circles denote the 1st to 4th quartiles of the radius, and the values of the L1 centrality quartiles are shown in red text. Note that red texts denote the L1 centrality quartiles, not radius quartiles.

print.L1centMDS() prints number of iterations it took to fit a target plot.

Note

The function L1centMDS() is valid only for undirected and connected graphs. Also, L1centMDS() only considers graphs with equal vertex multiplicities.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.

J. B. Kruskal. Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis. Psychometrika, 29(1):1–27, 1964a.

J. B. Kruskal. Nonmetric multidimensional scaling: a numerical method. Psychometrika, 29(2): 115–129, 1964b.

See Also

L1cent() for L1 centrality/prestige, MASS::isoMDS() and stats::cmdscale() for multidimensional scaling methods.

Examples

parameters <- L1centMDS(MCUmovie, verbose = FALSE)
plot(parameters)

L1 Centrality/Prestige-Based Neighborhood

Description

Derives L1 centrality- or L1 prestige-based neighborhood of each vertex. For undirected graphs, the two neighborhood are identical.

Usage

L1centNB(g, eta, mode)

## S3 method for class 'igraph'
L1centNB(g, eta = NULL, mode = c("centrality", "prestige"))

## S3 method for class 'matrix'
L1centNB(g, eta = NULL, mode = c("centrality", "prestige"))

## S3 method for class 'L1centNB'
print(x, ...)

Arguments

g

An igraph graph object or a distance matrix. The graph must be connected. For a directed graph, it must be strongly connected. Equivalently, all entries of the distance matrix must be finite. Here, the (i,j) component of the distance matrix is the geodesic distance from the ith vertex to the jth vertex.

eta

An optional nonnegative multiplicity (weight) vector for (vertex) weighted networks. The sum of its components must be positive. If set to NULL (the default), all vertices will have the same positive weight (multiplicity) of 1, i.e., g is treated as a vertex unweighted graph. The length of the eta must be equivalent to the number of vertices.

mode

A character string. For an undirected graph, either choice gives the same result.

  • centrality (the default): L1 centrality (prominence of each vertex in terms of making a choice) is used for analysis.

  • prestige: L1 prestige (prominence of each vertex in terms of receiving a choice) is used for analysis.

x

An L1centNB object, obtained as a result of the function L1cent().

...

Further arguments passed to or from other methods. This argument is ignored here.

Details

For an undirected graph, if the graph is symmetrized (in a way defined in Kang and Oh (2024a)) w.r.t. a vertex v, vertex v becomes the graph median (Kang and Oh 2024a), i.e., v has L1 centrality 1. Based on this property, we define the L1 centrality-based neighborhood of vertex v as vertices that have large L1 centrality on the symmetrized graph w.r.t. vertex v.

For a directed graph, a vertex of interest, say v, is made to a centrality and prestige median vertex by the procedure described in Kang and Oh (2024b). We call the resulting graph as the modified graph w.r.t. v. L1 centrality (prestige) -based neighborhood of vertex v is a set of vertices that have large L1 centrality (prestige) on the modified graph w.r.t. vertex v.

Value

L1centNB() returns an object of class L1centNB. It is a list of numeric vectors. The length of the list is equivalent to the number of vertices in the graph g, and the names of the list are vertex names. Each component of the list is a numeric vector whose length is equivalent to the number of vertices in the graph g. Specifically, the ith component of the list is a vector of the L1 centrality of each vertex, for the modified graph g w.r.t. the ith vertex (if mode = "centrality") or the L1 prestige of each vertex, for the modified graph g w.r.t. the ith vertex (if mode = "prestige").

print.L1centNB() prints L1 centrality or L1 prestige values at the modified graph w.r.t. each vertex and returns them invisibly.

Note

The function is valid only for connected graphs. If the graph is directed, it must be strongly connected.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024a.

S. Kang and H.-S. Oh. L1 prominence measures for directed graphs. arXiv preprint arXiv:2408.12078, 2024b.

See Also

L1cent() for L1 centrality/prestige, L1centLOC() and L1centEDGE() internally uses L1centNB(). Summary for a relevant summary method.

Examples

NB <- L1centNB(MCUmovie, eta = igraph::V(MCUmovie)$worldwidegross)
# Top 6 L1 centrality-based neighbors of "Iron Man"
utils::head(sort(NB$"Iron Man", decreasing = TRUE))

Marvel Cinematic Universe Movie Network

Description

Network between 32 movies from the Marvel Cinematic Universe (MCU) that were released between 2008 and 2023. Each movie represents one vertex.

An edge between movies i and j is formed if there is at least one cast in common. Denoting the set of casts of movie i as Ai, the weight of this edge is given as (|Ai\capAj|/|Ai\cupAj|)-1, where |\cdot| denotes the cardinality of a set.

Usage

data(MCUmovie)

Format

An undirected, connected, and (edge) weighted igraph graph object with 32 vertices and 278 edges.

Vertex attributes:

  • ‘name’: name of the movie. e.g., Guardians of the Galaxy Vol. 3.

  • ‘worldwidegross’: worldwide gross in USD. Archived from IMDb on Nov. 3rd, 2023.

  • ‘year’: release year of the movie.

Edge attribute: ‘weight’. Given as a dissimilarity between two vertices. See the description above.

Source

IMDb: https://www.imdb.com

References

G. Choi and H.-S. Oh. Heavy-snow transform: A new method for graph signals. Manuscript, 2021.

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.


Republic of Korea's 21st National Assembly Bill Cosponsorship Network

Description

Network between 317 members of the Republic of Korea's 21st National Assembly (May 30th, 2020–May 29th, 2024). Each member of the assembly represents one vertex.

An edge between two members is formed if there is at least one cosponsored bill. The weight of this edge is given as 1/(number of cosponsored bills between two members) during the first 40 months of the 21st assembly (Jun. 2020–Sep. 2023).

Usage

data(rokassembly21)

Format

An undirected, connected, and (edge) weighted igraph graph object with 317 vertices and 47,657 edges.

Vertex attributes:

  • ‘name’: Pseudonyms of each member. They are in the format of the party's initial character, followed by a random number (e.g., D4). Each party's initial character is:

    • ‘D’: Democratic Party of Korea.

    • ‘P’: People Power Party.

    • ‘J’: Justice Party.

    • ‘O’: Others (Basic Income Party, Hope of Korea, The Progressive Party, Transition Korea).

  • ‘party’: Factor with 7 levels. Denotes the political party of each member as of Sep. 2023. Note that independent members are assigned to their original party.

  • ‘gender’: Factor with 2 levels. ‘M’ (male) or ‘F’ (female).

  • ‘nelect’: Number of legislative terms in the assembly for each member. Ranges from 1 to 6.

  • ‘district’: Indicates if each member is a district representative (TRUE) or a proportional representative (FALSE).

  • ‘full’: Indicates if each member was in the assembly for the first 40 months. TRUE for the members in the office for all 40 months. Members who started their term via by-election, resigned, or lost their seat for any reason during the 40 months are coded as FALSE.

  • ‘nbill’: Number of bills cosponsored by each member.

Edge attribute: ‘weight’. Given as a dissimilarity between two vertices. See the description above.

Source

The National Assembly of the Republic of Korea

  • Bill information: https://likms.assembly.go.kr/bill/main.do

  • Member information: https://open.assembly.go.kr/portal/assm/search/memberSchPage.do

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.


Summary Methods in the L1centrality Package

Description

summary() methods for the classes in the L1centrality package.

Usage

## S3 method for class 'L1cent'
summary(object, ...)

## S3 method for class 'L1centLOC'
summary(object, ...)

## S3 method for class 'L1centNB'
summary(object, ...)

## S3 method for class 'L1centEDGE'
summary(object, ...)

## S3 method for class 'summaryL1centrality'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

object

An object used to select a method.

...

Further arguments passed to or from other methods. This argument is ignored here.

x

A summaryL1centrality object, obtained as a result of the function summary.L1cent() or summary.L1centLOC() or summary.L1centNB().

digits

Minimal number of significant digits, see print.default().

Value

For the methods for the class L1cent, L1centLOC, and L1centNB, object of class summaryL1centrality is returned. It is a summary of the prominence values with the five-number summary, mean, and the Gini coefficient.

For the method for the class L1centEDGE, number of local medians at each locality level alpha is returned.

References

S. Kang and H.-S. Oh. On a notion of graph centrality based on L1 data depth. arXiv preprint arXiv:2404.13233, 2024.

See Also

L1cent(), L1centLOC(), L1centNB(), L1centEDGE(), Heterogeneity.

Examples

summary(L1cent(MCUmovie))
summary(L1centLOC(MCUmovie, alpha = c(5/32, 10/32)))
head(summary(L1centNB(MCUmovie)))
summary(L1centEDGE(MCUmovie, alpha = c(5/32, 10/32)))