Question: The function IsIntervalGraph needs an additional option.

An interval graph is an undirected graph formed from a set of intervals on the real line, with a vertex for each interval and an edge between vertices whose intervals intersect. Recognizing interval graphs  is in linear time. 

Seven intervals on the real line and the corresponding seven-vertex interval graph.

 

 

IsIntervalGraph(G) (was introduced in Maple 2022) tests whether the graph G could be expressed as an interval graph for some collection of intervals. If a graph is an interval graph, then the intervals corresponding to its vertices should be given. However,  IsIntervalGraphdoes not provide such an option, which makes it impossible for me to verify the correctness of the results or see more information.

with(GraphTheory):
G:=Graph({{1,2},{1,3},{1,4}, {4,2},{4,3}});
IsIntervalGraph(G)

true

Therefore, an option like the "certificate" option in SageMath needs to be provided.

g = Graph({1: [2, 3, 4], 4: [2, 3]})
g.show()
g.is_interval()
g.is_interval(certificate=True)

(True, {1: (0, 5), 2: (4, 6), 3: (1, 3), 4: (2, 7)})

 

 

I have looked at the source code of IsIntervalGraphand it seems to be checking whether the complement graph is comparability. I am not sure if this transformation can still find the corresponding intervals.

print(IsIntervalGraph)
proc(G::GRAPHLN)::truefalse;
    local G2;
    G2 := GraphTheory:-GraphComplement(G);
    return GraphTheory:-IsComparabilityGraph(G2);
end proc

print(IsComparabilityGraph)
proc (G::GRAPHLN, { transitiveorientation::truefalse := false, 

   usecached::truefalseFAIL := FAIL }, ` $`)::truefalse; local 

   iscomparability, L, A, result, V; A := op(4, G); result := 

   FindTransitiveOrientation(A, transitiveorientation); if 

   result = NULL then false elif transitiveorientation then V 

   := op(3, G); true, GraphTheory:-Graph(V, result) else true 

   end if end proc

 

By the way, can the  "FindTransitiveOrientation "  in the function IsComparabilityGraph be used by the user?

Please Wait...