Skip to contents

Interval Graph

Usage

as_graph(object, ...)

# S4 method for class 'TimeIntervals'
as_graph(object, aggregate = TRUE, ...)

Arguments

object

A TimeIntervals object.

...

Currently not used.

aggregate

A logical scalar: should disjoint intervals referring to the same event be aggregated?

Value

An igraph graph object.

Details

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.

See also

Other chronological reasoning tools: overlap()

Author

N. Frerebeau

Examples

if (FALSE) { # \dontrun{
## 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")
)

## Do the intervals overlap?
overlap(int) > 0

## Interval graph
g <- as_graph(int)
plot(g)
} # }