Macaulay2 » Documentation
Packages » StatGraphs :: isLoopless
next | previous | forward | backward | up | index | toc

isLoopless -- check whether a graph contains a loop

Synopsis

Description

This method checks whether a graph contains a loop.

If the input is a Graph or a Bigraph, then this is equivalent to isSimple.

If the input is a Digraph, then this is equivalent to checking whether the underlyingGraph isSimple.

If the input is a MixedGraph, then this checks whether the undirected, directed and bidirected subgraphs separately contain loops.

i1 : U = graph{{1,2},{2,3},{3,4}}

o1 = Graph{1 => {2}   }
           2 => {1, 3}
           3 => {2, 4}
           4 => {3}

o1 : Graph
i2 : D = digraph{{2,5}}

o2 = Digraph{2 => {5}}
             5 => {}

o2 : Digraph
i3 : B = bigraph{{5,6}}

o3 = Bigraph{5 => {6}}
             6 => {5}

o3 : Bigraph
i4 : G = mixedGraph(U,D,B)

o4 = MixedGraph{Bigraph => Bigraph{5 => {6}}}
                                   6 => {5}
                Digraph => Digraph{2 => {5}}
                                   5 => {}
                Graph => Graph{1 => {2}   }
                               2 => {1, 3}
                               3 => {2, 4}
                               4 => {3}

o4 : MixedGraph
i5 : isLoopless G

o5 = true
i6 : U = graph{{1,1}}

o6 = Graph{1 => {1}}

o6 : Graph
i7 : isLoopless U

o7 = false

Ways to use isLoopless :

For the programmer

The object isLoopless is a method function.