same_elements: Number of Equal Elements Between Each Decoration Pair

same_elementsR Documentation

Number of Equal Elements Between Each Decoration Pair

Description

Create the (symmetric) dataframe with the count of common nodes or common edges (see list_compar for comparison criteria) for each pair of decorations (graphs) from a list. The diagonal of the symmetric dataframe is filled with counts of nodes/edges for each decoration.

Usage

same_elements(lgrph, nd.var = "type", focus = "nodes")

Arguments

lgrph

a list of any number of graphs to be pairwise compared. The list can be typically obtained with the function list_dec.

nd.var

an attribute of the graph vertices containing the node variable (ie, field) on which the comparison will be done. By default nd.var = "type".

focus

either "nodes" (default) or "edges" to select the type of elements to be compared for the count.

Value

A symmetric matrix with the counts of the pairwise coincidences of nodes or edges. The matrix has as row and column names the names of the corresponding graphs in the input list.

See Also

list_dec, list_compar, plot_compar.

Examples


# read imgs, nodes and edges dataframes
imgs <- read.table(system.file("extdata", "imgs.tsv", package = "iconr"),
                   sep="\t",stringsAsFactors = FALSE)
nodes <- read.table(system.file("extdata", "nodes.tsv", package = "iconr"),
                    sep="\t",stringsAsFactors = FALSE)
edges <- read.table(system.file("extdata", "edges.tsv", package = "iconr"),
                    sep="\t",stringsAsFactors = FALSE)
lgrph <- list_dec(imgs,nodes,edges)

# Counting same nodes
df.same_nodes <- same_elements(lgrph, nd.var = "type",
                               focus = "nodes")
df.same_nodes
## a symmetric matrix of nodes comparisons

# same edges
df.same_edges <- same_elements(lgrph, nd.var = "type",
                               focus = "edges")
df.same_edges
## a symmetric matrix of edges comparisons


zoometh/iconr documentation built on Nov. 9, 2023, 10:01 a.m.