Skip to contents

Creates an interval or a stratigraphic graph.

Usage

as_graph(edges, ...)

# S4 method for class 'data.frame'
as_graph(
  edges,
  type = c("interval", "stratigraphy"),
  direction = c("above", "below"),
  simplify = TRUE,
  reduce = TRUE,
  verbose = getOption("aion.verbose"),
  ...
)

# S4 method for class 'matrix'
as_graph(
  edges,
  type = c("interval", "stratigraphy"),
  direction = c("above", "below"),
  simplify = TRUE,
  reduce = TRUE,
  verbose = getOption("aion.verbose"),
  ...
)

# S4 method for class 'TimeIntervals'
as_graph(
  edges,
  type = c("interval", "stratigraphy"),
  simplify = TRUE,
  reduce = TRUE,
  verbose = getOption("aion.verbose"),
  ...
)

Arguments

edges

A TimeIntervals object or a two-columns character matrix of edges (i.e. where each row specifies one relation element).

...

Currently not used.

type

A character string specifying the type of the graph to be computed. It must be one of "interval" (the default) or "stratigraphy" (see details). Any unambiguous substring can be given.

direction

A character string specifying the direction of the relations in x. It must be one of "above" (the default) or "below" (see details). Any unambiguous substring can be given. Only used if type is "stratigraphy".

simplify

A logical scalar: should multiple edges and loop edges be removed?

reduce

A logical scalar: should transitive reduction be performed? Only used if type is "stratigraphy".

Value

An igraph graph object.

Details

interval

An interval graph is the graph showing intersecting intervals on a line. As time is linear and not circular, an interval graph contains no cycles with more than three edges and no shortcuts (it must be a chordal graph).

stratigraphy

A stratigraphic graph represents directed relationships between (stratigraphic) units (it must be a directed acyclic graph).

Note

Experimental: might change in a future release.

The igraph and relations packages needs to be installed on your machine.

See also

Other temporal relations: overlap(), relations

Author

N. Frerebeau

Examples

if (requireNamespace("igraph", quietly = TRUE) &&
    requireNamespace("relations", quietly = TRUE)) {
  ## Seven intervals
  int <- intervals(
    start = c(1, 2, 3, 6, 9, 13, 17),
    end = c(7, 4, 15, 14, 11, 18, 19),
    calendar = CE(),
    names = c("A", "B", "C", "D", "E", "F", "G")
  )

  ## Interval graph
  g <- as_graph(int, type = "interval")
  plot(g)

  ## Stratigraphic graph
  g <- as_graph(int, type = "strati")
  plot(g, layout = igraph::layout_with_sugiyama)
}