Close
Close window
IntervalGraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

GraphTheory

IntervalGraph

construct an interval graph

IsIntervalGraph

test if graph is an interval graph

Calling Sequence

IntervalGraph(C)

IsIntervalGraph(G)

Parameters

C

-

a list, Vector, or 1-D Array of intervals

G

-

an undirected graph

Description

IntervalGraph(c) returns an interval graph for the collection of intervals C.

Each element of the input C must be a range or a RealRange expression. A range a..b is interpreted as the closed real interval from a to b. To specify open or half-open intervals, you can use RealRange.

The vertices of the resulting graph correspond to the intervals given in C. An edge between vertices exists if the corresponding intervals have non-empty intersection.

IsIntervalGraph(G) tests whether the graph G could be expressed as an interval graph for some collection of intervals.

Definition

An interval graph is the intersection graph of a set of intervals on the real line. For any vertices i, j in the graph, an edge between i and j exists if and only if the intervals i and j have non-empty intersection.

Examples

Compute the interval graph for {1..3, 2..4, 3..5}.

>

withGraphTheory:

>

GIntervalGraph1..3,2..4,3..5

GGraph 1: an undirected graph with 3 vertices and 3 edges

(1)

Construct a schedule to distribute a set of business meetings across several conference rooms.

>

Meetings9..11.5,9.5..10,9.75..15,11.5..15,12.5..13.5,14.5..17,16.5..17.5

Meetings9..11.5,9.5..10,9.75..15,11.5..15,12.5..13.5,14.5..17,16.5..17.5

(2)
>

RoomNamesSuite Infinity,Geddes Suite,Taylor's Suite

RoomNamesSuite Infinity,Geddes Suite,Taylor's Suite

(3)
>

ScheduleGreedyColorIntervalGraphMeetings

Schedule3,1,2,0,2,1,1,0

(4)
>

RoomiRoomNamesSchedule2ListTools:−Searchi,Meetings+1:

>

ListTools:-ClassifyRoom,Meetings

tableSuite Infinity=9.75..15,16.5..17.5,Geddes Suite=9..11.5,12.5..13.5,14.5..17,Taylor's Suite=9.5..10,11.5..15

(5)

The following interval graph has only one edge because the intervals 0..1 and 1..2 intersect at 1, but the half-open interval −1,0 does not intersect 0..1.

>

IntervalGraphRealRange1,Open0,0..1,1..2

Graph 2: an undirected graph with 3 vertices and 1 edge

(6)

Visualize the relationships within a set of intervals.

>

GIntervalGraph0..8,1..π,exp1..20,7..18,11..14,RealRange17,Open23,23..25

GGraph 3: an undirected graph with 7 vertices and 9 edges

(7)
>

DrawGraphG

Verify this is an interval graph

>

IsIntervalGraphG

true

(8)

Compatibility

The GraphTheory[IntervalGraph] command was introduced in Maple 2016.

For more information on Maple 2016 changes, see Updates in Maple 2016 .

The GraphTheory[IntervalGraph] command was updated in Maple 2020.

The GraphTheory[IsIntervalGraph] command was introduced in Maple 2022.

For more information on Maple 2022 changes, see Updates in Maple 2022 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /