isSimple(MixedGraph) -- check whether a mixed graph is simple

Synopsis

• Function: isSimple
• Usage:
isSimple(G)
• Inputs:
• Outputs:

Description

This method checks whether a graph is simple: does not contain loops or multiple edges. Note that since graph, digraph and bigraph do not allow multiple edges, a graph of class MixedGraph can only have multiple edges of different types.

In the following example, there are no loops or multiple edges.

 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 : isSimple G o5 = true

This example contains multiple edges on vertices 1 and 2.

 i6 : U = graph{{1,2},{2,3},{3,4}} o6 = Graph{1 => {2} } 2 => {1, 3} 3 => {2, 4} 4 => {3} o6 : Graph i7 : D = digraph{{1,2},{2,5}} o7 = Digraph{1 => {2}} 2 => {5} 5 => {} o7 : Digraph i8 : B = bigraph{{5,6}} o8 = Bigraph{5 => {6}} 6 => {5} o8 : Bigraph i9 : G = mixedGraph(U,D,B) o9 = MixedGraph{Bigraph => Bigraph{5 => {6}}} 6 => {5} Digraph => Digraph{1 => {2}} 2 => {5} 5 => {} Graph => Graph{1 => {2} } 2 => {1, 3} 3 => {2, 4} 4 => {3} o9 : MixedGraph i10 : isSimple G o10 = false

This example contains a loop.

 i11 : U = graph{{1,2},{2,3},{3,4}} o11 = Graph{1 => {2} } 2 => {1, 3} 3 => {2, 4} 4 => {3} o11 : Graph i12 : D = digraph{{2,5}} o12 = Digraph{2 => {5}} 5 => {} o12 : Digraph i13 : B = bigraph{{5,6},{5,5}} o13 = Bigraph{5 => {5, 6}} 6 => {5} o13 : Bigraph i14 : G = mixedGraph(U,D,B) o14 = MixedGraph{Bigraph => Bigraph{5 => {5, 6}}} 6 => {5} Digraph => Digraph{2 => {5}} 5 => {} Graph => Graph{1 => {2} } 2 => {1, 3} 3 => {2, 4} 4 => {3} o14 : MixedGraph i15 : isSimple G o15 = false