named_elements: Textual Notation of Graph Elements

View source: R/named_elements.R

named_elementsR Documentation

Textual Notation of Graph Elements

Description

Create a textual notation for nodes or edges.

Usage

named_elements(grph, focus = "edges", nd.var = "type", disamb.marker = "#")

Arguments

grph

A decoration graph (object of class igraph).

focus

Textual notation of edges (focus = "edges") or nodes (focus = "nodes"). By default focus = "edges".

nd.var

The attribute of the graph nodes containing the node variable (ie, field) for the textual annotation. By default nd.var = "type".

disamb.marker

Marker used to disambiguated repeated elements. By default disamb.marker = "#".

Details

Edges of type '=' (normal edges) are undirected, so that the order of their nodes is irrelevant and they are presented in alphabetical order. Conversely, edges of types '+' (attribute edges) and '>' (diachronic edges) are directed, so that the given order of nodes is preserved. Repeated node or edge names are disambiguated by appending the symbol disamb.marker ('#' by default) at the end of the second appearance (suffix). Subsequent appearances are marked by additional disamb.markers.

Value

A character vector of named nodes or edges.

See Also

list_compar, same_elements.

Examples


# Read data
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)

# Generate list of graphs from the three data.frames
lgrph <- list_dec(imgs, nodes, edges)

# Textual notation of disambiguated edges
named_elements(lgrph[[2]], focus = "edges", nd.var="type")

# Textual notation of disambiguated nodes
named_elements(lgrph[[2]], focus = "nodes", nd.var="type")


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