named_elements: Textual Notation of Graph Elements

Description Usage Arguments Details Value See Also Examples

View source: R/named_elements.R

Description

Create a textual notation for nodes or edges.

Usage

1
2
3
4
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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")

iconr documentation built on Feb. 16, 2021, 5:06 p.m.