similarity.graph: Create a graph based on similarites of vertices/nodes

Description Usage Arguments Value

Description

Makes a graph (in the igraph format) in which ties represent similarities between nodes, based on a matrix in which rows are cases (e.g., documents, authors, organizations), and columns are attributes of these cases (e.g., terms, authored-documents, countries). Vertices (i.e. nodes) are defined as unique combinations of vertex.grouping.vars. If vertices cover multiple documents (e.g., authors of several documents) then content characteristics are first aggregated. The (aggregated) content characteristics are used to calculate the similarities between vertices, for which various similarity measures can be used.

Usage

1
2
3
similarity.graph(m, vertex.grouping.vars, similarity.measure = "cosine",
  min.similarity = NULL, attributes.as.vertexmeta = NULL,
  attributes.relative = T)

Arguments

m

A (sparse) matrix where rows represent cases and columns represent attributes. Similarities are calculated between cases based on their scores on attributes. For example, if rows are documents, and columns are terms (e.g., a DocumentTermMatrix), then the similarities between documents are calculated based on their terms. Or, if rows are authors and columns are documents, then similarity between authors is calculated based on what documents they co-authored.

vertex.grouping.vars

Vectors of the same length and order as the rows of m, representing vertex/node characteristics. Each unique combination of characteristics will be considered a vertex. In the graph object these characteristics are stored as vertex attributes.

similarity.measure

A character string giving a method for computing similarity. Options (currently) are: 'correlation', 'cosine','conditional_probability','overlap_count' and 'overlap_jacard'.

min.similarity

A numeric scalar representing the threshold for similarities. All ties with a value below min.similarity will be deleted. Can be used to reduce the size of large graphs with many weak ties.

attributes.as.vertexmeta

Can be used to include the sum of values of attributes for each vertex as vertex meta. if 'all', all attributes will be included. Can also be a numeric vector to select specific attributes. If m has row names, these are used to name the attributes. Otherwise, they are labeled 'att' followed by the number (att1, att2, etc)

attributes.relative

Logical. If attributes.as.vertexmeta is used, should the summed attribute scores per vertex be made relative to all attribute scores of the vertex?

Value

A graph object in the igraph format


kasperwelbers/network-tools documentation built on May 20, 2019, 7:38 a.m.