# MultifunctionGraph S¶

graph.spad line 4104 [edit on github]

S: SetCategory

allows us to model graph theory

- *: (%, %) -> MultifunctionGraph Product(S, S)
tensor product : the tensor product

`G*H`

of graphs`G`

and`H`

is a graph such that the vertex set of`G*H`

is the Cartesian product`V`

(`G`

) times`V`

(`H`

); and any two vertices (`u`

, u’) and (`v`

,`v'`

) are adjacent in`G`

times`H`

if and only if u’ is adjacent with`v'`

and`u`

is adjacent with`v`

.

- +: (%, %) -> %
from FiniteGraph S

- ~: % -> %
The complement or inverse of a graph is a graph on the same vertices such that there is an arrow if and only if there is not an arrow in its compliment. That is, it is the compliment of the arrows but is not the set complement. for more information see: http://en.wikipedia.org/wiki/Complement_graph

- addArrow!: (%, Record(name: String, arrType: NonNegativeInteger, fromOb: NonNegativeInteger, toOb: NonNegativeInteger, xOffset: Integer, yOffset: Integer, map: List NonNegativeInteger)) -> %
from FiniteGraph S

- addArrow!: (%, String, NonNegativeInteger, NonNegativeInteger) -> %
from FiniteGraph S

- addArrow!: (%, String, NonNegativeInteger, NonNegativeInteger, List NonNegativeInteger) -> %
from FiniteGraph S

- addArrow!: (%, String, S, S) -> %
from FiniteGraph S

- addObject!: (%, Record(value: S, posX: NonNegativeInteger, posY: NonNegativeInteger)) -> %
from FiniteGraph S

- addObject!: (%, S) -> %
from FiniteGraph S

- adjacencyMatrix: % -> Matrix NonNegativeInteger
from FiniteGraph S

- apply: (%, NonNegativeInteger, NonNegativeInteger) -> NonNegativeInteger
`apply '`

function’ represented by this graph to vertex index ‘a’

- arrowName: (%, NonNegativeInteger, NonNegativeInteger) -> String
from FiniteGraph S

- arrowsFromArrow: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- arrowsFromNode: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- arrowsToArrow: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- arrowsToNode: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- cartesian: (%, %) -> MultifunctionGraph Product(S, S)
Cartesian product doubles the size of next list in each object, that is it produces two arrows out of every node

- closedCartesian: (%, %, (S, S) -> S) -> %
Cartesian product doubles the size of next list in each object, that is it produces two arrows out of every node

- closedTensor: (%, %, (S, S) -> S) -> %
as tensor product but returns %.

- coAdjoint: (%, List NonNegativeInteger) -> Union(List NonNegativeInteger, failed)
given a mapping from this graph this function tries to calculate a unique reverse mapping back to this graph

- coerce: % -> OutputForm
from CoercibleTo OutputForm

- coerce: PermutationGroup S -> %
`coerce PermutationGroup`

to graph which represents the generators of the group

- contraAdjoint: (%, List NonNegativeInteger) -> Union(List NonNegativeInteger, failed)
given a mapping from this graph this function tries to calculate a unique reverse mapping back to this graph

- cycleClosed: (List S, String) -> %
from FiniteGraph S

- cycleOpen: (List S, String) -> %
from FiniteGraph S

- deepDiagramSvg: (String, %, Boolean) -> Void
from FiniteGraph S

- diagramHeight: % -> NonNegativeInteger
from FiniteGraph S

- diagramsSvg: (String, List %, Boolean) -> Void
from FiniteGraph S

- diagramSvg: (String, %, Boolean) -> Void
from FiniteGraph S

- diagramWidth: % -> NonNegativeInteger
from FiniteGraph S

- distance: (%, NonNegativeInteger, NonNegativeInteger) -> Integer
from FiniteGraph S

- distanceMatrix: % -> Matrix Integer
from FiniteGraph S

- flatten: DirectedGraph % -> %
from FiniteGraph S

- getArrowIndex: (%, NonNegativeInteger, NonNegativeInteger) -> NonNegativeInteger
from FiniteGraph S

- getArrows: % -> List Record(name: String, arrType: NonNegativeInteger, fromOb: NonNegativeInteger, toOb: NonNegativeInteger, xOffset: Integer, yOffset: Integer, map: List NonNegativeInteger)
from FiniteGraph S

- getVertexIndex: (%, S) -> NonNegativeInteger
from FiniteGraph S

- getVertices: % -> List Record(value: S, posX: NonNegativeInteger, posY: NonNegativeInteger)
from FiniteGraph S

- incidenceMatrix: % -> Matrix Integer
from FiniteGraph S

- inDegree: (%, NonNegativeInteger) -> NonNegativeInteger
from FiniteGraph S

- initial: () -> %
from FiniteGraph S

- isAcyclic?: % -> Boolean
from FiniteGraph S

- isDirected?: () -> Boolean
from FiniteGraph S

- isDirectSuccessor?: (%, NonNegativeInteger, NonNegativeInteger) -> Boolean
from FiniteGraph S

- isFixPoint?: (%, NonNegativeInteger) -> Boolean
from FiniteGraph S

- isFunctional?: % -> Boolean
from FiniteGraph S

- isGreaterThan?: (%, NonNegativeInteger, NonNegativeInteger) -> Boolean
from FiniteGraph S

- kgraph: (List S, String) -> %
from FiniteGraph S

- laplacianMatrix: % -> Matrix Integer
from FiniteGraph S

- latex: % -> String
from SetCategory

- limit: (%, NonNegativeInteger, NonNegativeInteger) -> Loop
apply ‘function’ represented by this graph to ‘a’ repeatedly until we reach a loop which is returned as a sequence of vertex indexes.

- loopsArrows: % -> List Loop
from FiniteGraph S

- loopsAtNode: (%, NonNegativeInteger) -> List Loop
from FiniteGraph S

- loopsNodes: % -> List Loop
from FiniteGraph S

- looseEquals: (%, %) -> Boolean
from FiniteGraph S

- map: (%, List NonNegativeInteger, List S, Integer, Integer) -> %
from FiniteGraph S

- mapContra: (%, List NonNegativeInteger, List S, Integer, Integer) -> %
from FiniteGraph S

- max: % -> NonNegativeInteger
from FiniteGraph S

- max: (%, List NonNegativeInteger) -> NonNegativeInteger
from FiniteGraph S

- merge: (%, %) -> %
from FiniteGraph S

- min: % -> NonNegativeInteger
from FiniteGraph S

- min: (%, List NonNegativeInteger) -> NonNegativeInteger
from FiniteGraph S

- multifunctionGraph: (List Record(value: S, posX: NonNegativeInteger, posY: NonNegativeInteger), List Record(name: String, arrType: NonNegativeInteger, fromOb: NonNegativeInteger, toOb: NonNegativeInteger, xOffset: Integer, yOffset: Integer, map: List NonNegativeInteger)) -> %
`multifunctionGraph(lo, la)`

constructs a graph with given list of objects la and list of arrows la. More objects and arrows can be added later if required.

- multifunctionGraph: (List S, List List NonNegativeInteger) -> %
`multifunctionGraph(lo, am)`

constructs a graph given list of objects`lo`

and adjacency matrix am.

- multifunctionGraph: List Permutation S -> %
construct graph from a list of permutations.

- multifunctionGraph: List Record(value: S, posX: NonNegativeInteger, posY: NonNegativeInteger, next: List NonNegativeInteger, map: List List NonNegativeInteger) -> %
`multifunctionGraph(l)`

constructs a graph with given list`l`

of objects. More objects and arrows can be added later if required.

- multifunctionGraph: List S -> %
`multifunctionGraph(l)`

constructs a graph with given list`l`

of object names. Use this version of the constructor if you don`'t`

intend to create diagrams and therefore don`'t`

care about`x`

,`y`

coordinates. More objects and arrows can be added later if required.

- nodeFromArrow: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- nodeFromNode: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- nodeToArrow: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- nodeToNode: (%, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- outDegree: (%, NonNegativeInteger) -> NonNegativeInteger
from FiniteGraph S

- routeArrows: (%, NonNegativeInteger, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- routeNodes: (%, NonNegativeInteger, NonNegativeInteger) -> List NonNegativeInteger
from FiniteGraph S

- spanningForestArrow: % -> List Tree Integer
from FiniteGraph S

- spanningForestNode: % -> List Tree Integer
from FiniteGraph S

- spanningTreeArrow: (%, NonNegativeInteger) -> Tree Integer
from FiniteGraph S

- spanningTreeNode: (%, NonNegativeInteger) -> Tree Integer
from FiniteGraph S

- subdiagramSvg: (Scene SCartesian 2, %, Boolean, Boolean) -> Void
from FiniteGraph S

- terminal: S -> %
from FiniteGraph S

- toCayleyGraph: (List Permutation S, Boolean) -> MultifunctionGraph String
convert permutation generators to a Cayley graph permList should contain generator permutations and should not contain identity permutation. if permutationNames then names generated represent permutation

- toCayleyGraph: PermutationGroup S -> MultifunctionGraph String
convert PermutationGroup to a Cayley graph

- toPermutation: % -> PermutationGroup NonNegativeInteger
generates a permutation group from this graph assumes this graph represents a valid group

- unit: (List S, String) -> %
from FiniteGraph S