pald {pald}R Documentation

Partitioned Local Depth (PaLD)

Description

A wrapper function which computes the cohesion matrix, local depths, community graphs and provides a plot of the community graphs with connected components of the graph of strong ties colored by connected component.

Usage

pald(
  d,
  show_plot = TRUE,
  show_labels = TRUE,
  only_strong = FALSE,
  emph_strong = 2,
  edge_width_factor = 50,
  colors = NULL,
  layout = NULL,
  ...
)

Arguments

d

A matrix of pairwise distances or a dist object.

show_plot

Set to TRUE to display plot; the default is TRUE.

show_labels

Set to FALSE to omit vertex labels (to display a subset of labels, use optional parameter vertex.label to modify the label list). Default: TRUE.

only_strong

Set to TRUE if only strong ties, G_strong, should be displayed; the default FALSE will show both strong (colored by connected component) and weak ties (in gray).

emph_strong

Numeric. The numeric factor by which the edge widths of strong ties are emphasized in the display; the default is 2.

edge_width_factor

Numeric. Modify to change displayed edge widths. Default: 50.

colors

A vector of display colors, if none is given a default list (of length 24) is provided.

layout

A layout for the graph. If none is specified, FR-graph drawing algorithm is used.

...

Optional parameters to pass to the igraph::plot.igraph. function. Some commonly passed arguments include:

  • vertex.label A vector containing label names. If none is given, the rownames of c are used

  • vertex.size A numeric value for vertex size (default = 1)

  • vertex.color.vec A vector of color names for coloring the vertices

  • vertex.label.cex A numeric value for modifying the vertex label size. (default = 1)

Details

This function re-computes the cohesion matrix each time it is run. To avoid unnecessary computation when creating visualizations, use the function cohesion_matrix to compute the cohesion matrix which may then be taken as input for local_depths, strong_threshold, cohesion_strong, community_graphs, and plot_community_graphs. For further details regarding each component, see the documentation for each of the above functions.

Value

A list consisting of:

References

K. S. Berenhaut, K. E. Moore, R. L. Melvin, A social perspective on perceived distances reveals deep community structure. Proc. Natl. Acad. Sci., 119(4), 2022.

Examples

D <- dist(exdata2)
pald_results <- pald(D)
pald_results$local_depths
pald(D, layout = as.matrix(exdata2), show_labels = FALSE)

C <- cohesion_matrix(D)
local_depths(C)
plot_community_graphs(C, layout = as.matrix(exdata2), show_labels = FALSE)

pald_languages <- pald(cognate_dist)
head(pald_languages$local_depths)


[Package pald version 0.0.4 Index]