Skip to contents

Creates an interval or a stratigraphic graph.

Usage

graph_create(object, ...)

# S4 method for class 'data.frame'
graph_create(
  object,
  type = c("interval", "stratigraphy"),
  direction = c("above", "below"),
  verbose = getOption("aion.verbose"),
  ...
)

# S4 method for class 'matrix'
graph_create(
  object,
  type = c("interval", "stratigraphy"),
  direction = c("above", "below"),
  verbose = getOption("aion.verbose"),
  ...
)

# S4 method for class 'TimeIntervals'
graph_create(
  object,
  type = c("interval", "stratigraphy"),
  verbose = getOption("aion.verbose"),
  ...
)

Arguments

object

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 relevant if type is "stratigraphy".

verbose

A logical scalar: should R report extra information on progress?

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 the directed relationships between temporal units (archaeological deposits), from the most recent to the oldest (Harris 1997). It can be formally defined as a directed acyclic graph (DAG), in which each vertex represents a layer and the edges represent stratigraphic relations.

Note

Experimental.

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

References

Harris, Edward C., 1997. Principles of Archaeological Stratigraphy. Seconde edition. Academic Press.

See also

Other graph tools: graph_prune()

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 <- graph_create(int, type = "interval")
  plot(g)

  ## Stratigraphic graph
  g <- graph_create(int, type = "strati")
  g <- graph_prune(g) # Remove redundant relations
  plot(g, layout = igraph::layout_with_sugiyama)
}