This is StatGraphs.info, produced by Macaulay2, version 1.22

StatGraphs -- a package for graphs used in statistical models
*************************************************************

Description
===========

This package contains the types of graphs that are used in algebraic
statistics: Bigraph, and  MixedGraph.

A bigraph is graph with bidirected edges and no multiple edges. A mixed graph
is a graph with undirected, directed and bidirected edges.

This is an example of a bigraph on 4 vertices. It is created using the method
bigraph.

+------------------------------------+
|i1 : G = bigraph {{3,4},{1,2},{2,4}}|
|                                    |
|o1 = Bigraph{1 => {2}   }           |
|             2 => {4, 1}            |
|             3 => {4}               |
|             4 => {3, 2}            |
|                                    |
|o1 : Bigraph                        |
+------------------------------------+

Next is an example of a mixed graph on 4 vertices with undirected, directed and
bidirected edges. It is created using the method mixedGraph.

+-----------------------------------------------------------------------+
|i2 : G = mixedGraph(graph{{1,2}},digraph {{1,3},{2,3}},bigraph {{3,4}})|
|                                                                       |
|o2 = MixedGraph{Bigraph => Bigraph{3 => {4}}}                          |
|                                   4 => {3}                            |
|                Digraph => Digraph{1 => {3}}                           |
|                                   2 => {3}                            |
|                                   3 => {}                             |
|                Graph => Graph{1 => {2}}                               |
|                               2 => {1}                                |
|                                                                       |
|o2 : MixedGraph                                                        |
+-----------------------------------------------------------------------+

One can extract key information about mixed graphs using:
undirectedGraph(MixedGraph), bigraph(MixedGraph),
see digraph(MixedGraph),
vertices(MixedGraph),

or convert a mixed graph into a more convenient form using:
collateVertices(MixedGraph),
indexLabelGraph(MixedGraph).

There are several methods that allow to check the properties of mixed graphs:
isCyclic(MixedGraph),
isLoopless(MixedGraph), isSimple(MixedGraph).

One can also study the properties of vertices using:
children(MixedGraph,Thing),
parents(MixedGraph,Thing),
descendants(MixedGraph,Thing),
nondescendants(MixedGraph,Thing),
forefathers(MixedGraph,Thing),
neighbors(MixedGraph,Thing),
nonneighbors(MixedGraph,Thing).

This package allows to construct loopless mixed graphs (LMG) as introduced in
Kayvan Sadeghi and Steffen Lauritzen, Markov properties for mixed graphs,
Bernoulli 20.2 (2014): 676-696 and to check whether a mixedGraph is an LMG
using partitionLMG.

Caveat
======

StatGraphs requires  Graphs, version 0.3.3 or later.

See also
========

  * Graphs

Authors
=======

  * Carlos Amendola (see http://www.carlos-amendola.com/ )
    <carlos.amendola@tum.de>
  * Luis David Garcia Puente (see http://www.shsu.edu/~ldg005 )
    <lgarcia@shsu.edu>
  * Roser Homs Pons (see https://personal-homepages.mis.mpg.de/homspons/index.
    html ) <roser.homs@tum.de>
  * Olga Kuznetsova (see https://okuznetsova.com ) <kuznetsova.olga@gmail.com>
  * Harshit J Motwani (see https://sites.google.com/view/harshitjmotwani/home )
    <harshitmotwani2015@gmail.com>

Version
=======

This documentation describes version 0.1 of StatGraphs.

Source code
===========

The source code from which this documentation is derived is in the file
StatGraphs.m2 (see common/share/Macaulay2/StatGraphs.m2 ).

Exports
=======

  * Types
      * Bigraph -- a graph with bidirected edges and no
        multiple edges
      * MixedGraph -- a graph that has undirected, directed
        and bidirected edges
  * Functions and commands
      * bigraph -- create a bigraph
      * collateVertices -- convert a mixed graph into a
        new mixed graph where each component subgraph has the same set of
        vertices
      * isLoopless -- check whether a graph contains a loop
      * mixedGraph -- create a mixed graph from a
        combination of undirected graph, digraph and bigraph
      * partitionLMG -- partition the vertices of a
        loopless mixed graph into adjacent to undirected edges and adjacent to
        bidirected edges
      * undirectedGraph -- extract the undirected graph
        component of a mixed graph
  * Methods
      * "bigraph(HashTable)" -- see bigraph, -- create a bigraph
      * "bigraph(List)" -- see bigraph, -- create a bigraph
      * "bigraph(List,List)" -- see bigraph, -- create a bigraph
      * "bigraph(List,Matrix)" -- see bigraph, -- create a
        bigraph
      * "bigraph(Matrix)" -- see bigraph, -- create a bigraph
      * bigraph(MixedGraph) -- extract the
        bigraph component of a mixed graph
      * children(MixedGraph,Thing), --
        return the children of a vertex of a mixed graph
      * "collateVertices(MixedGraph)" -- see collateVertices,
        -- convert a mixed graph into a new mixed graph where
        each component subgraph has the same set of vertices
      * descendants(MixedGraph,Thing)
        -- return the descendants of a
        vertex of a mixed graph
      * digraph(MixedGraph) -- extract the
        digraph component of a mixed graph
      * forefathers(MixedGraph,Thing)
        -- return the forefathers of a
        vertex of a mixed graph
      * graph(MixedGraph) -- convert mixed graph
        to a hash table
      * indexLabelGraph(MixedGraph), --
        relabel the vertices of a mixed graph according to their indices,
        indexed from 0
      * isCyclic(MixedGraph) -- check whether
        a mixed graph contains a directed cycle
      * "isLoopless(Bigraph)" -- see isLoopless, -- check
        whether a graph contains a loop
      * "isLoopless(Digraph)" -- see isLoopless, -- check
        whether a graph contains a loop
      * "isLoopless(Graph)" -- see isLoopless, -- check
        whether a graph contains a loop
      * "isLoopless(MixedGraph)" -- see isLoopless, -- check
        whether a graph contains a loop
      * isSimple(MixedGraph) -- check whether
        a mixed graph is simple
      * "mixedGraph(Bigraph)" -- see mixedGraph, -- create a
        mixed graph from a combination of undirected graph, digraph and bigraph
      * "mixedGraph(Bigraph,Digraph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Bigraph,Digraph,Graph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * "mixedGraph(Bigraph,Graph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Bigraph,Graph,Digraph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * "mixedGraph(Digraph)" -- see mixedGraph, -- create a
        mixed graph from a combination of undirected graph, digraph and bigraph
      * "mixedGraph(Digraph,Bigraph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Digraph,Bigraph,Graph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * "mixedGraph(Digraph,Graph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Digraph,Graph,Bigraph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * "mixedGraph(Graph)" -- see mixedGraph, -- create a
        mixed graph from a combination of undirected graph, digraph and bigraph
      * "mixedGraph(Graph,Bigraph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Graph,Bigraph,Digraph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * "mixedGraph(Graph,Digraph)" -- see mixedGraph, --
        create a mixed graph from a combination of undirected graph, digraph
        and bigraph
      * "mixedGraph(Graph,Digraph,Bigraph)" -- see mixedGraph,
        -- create a mixed graph from a combination of undirected
        graph, digraph and bigraph
      * neighbors(MixedGraph,Thing),
        -- return the neighbors of a vertex of a mixed graph
      * net(MixedGraph) -- print a mixed graph as a
        net
      * nondescendants(MixedGraph,Thing)
        -- return the nondescendents of
        a vertex of a mixed graph
      * nonneighbors(MixedGraph,Thing)
        -- return the neighbors of a
        vertex of a mixed graph
      * parents(MixedGraph,Thing), --
        return the parents of a vertex of a mixed graph
      * "partitionLMG(MixedGraph)" -- see partitionLMG, --
        partition the vertices of a loopless mixed graph into adjacent to
        undirected edges and adjacent to bidirected edges
      * toString(MixedGraph) -- print a mixed
        graph as a string
      * "undirectedGraph(MixedGraph)" -- see undirectedGraph,
        -- extract the undirected graph component of a mixed
        graph
      * "vertexSet(MixedGraph)" -- see vertices(MixedGraph),
        -- create a union of all vertices of a mixed
        graph
      * vertices(MixedGraph) -- create a union
        of all vertices of a mixed graph

For the programmer
==================

The object StatGraphs, is a package (Macaulay2Doc).

Bigraph -- a graph with bidirected edges and no multiple edges
**************************************************************

Description
===========

Bigraph is a simple graph that has  bidirected edges. To create a bigraph, use
bigraph.

See also
========

  * bigraph -- create a bigraph

Functions and methods returning an object of class Bigraph :
============================================================

  * bigraph -- create a bigraph

Methods that use an object of class Bigraph :
=============================================

  * "isLoopless(Bigraph)" -- see isLoopless, -- check whether
    a graph contains a loop
  * "mixedGraph(Bigraph)" -- see mixedGraph, -- create a
    mixed graph from a combination of undirected graph, digraph and bigraph
  * "mixedGraph(Bigraph,Digraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Bigraph,Digraph,Graph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Bigraph,Graph)" -- see mixedGraph, -- create
    a mixed graph from a combination of undirected graph, digraph and bigraph
  * "mixedGraph(Bigraph,Graph,Digraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Digraph,Bigraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Digraph,Bigraph,Graph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Digraph,Graph,Bigraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Graph,Bigraph)" -- see mixedGraph, -- create
    a mixed graph from a combination of undirected graph, digraph and bigraph
  * "mixedGraph(Graph,Bigraph,Digraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph
  * "mixedGraph(Graph,Digraph,Bigraph)" -- see mixedGraph, --
    create a mixed graph from a combination of undirected graph, digraph and
    bigraph

For the programmer
==================

The object Bigraph, is a type (Macaulay2Doc), with
ancestor classes Graph (Graphs), < Digraph (Graphs)
< HashTable (Macaulay2Doc) < Thing (Macaulay2Doc).

bigraph -- create a bigraph
***************************

Synopsis
========

  * Usage:
        G= bigraph(H)
        G= bigraph(L)
        G= bigraph(V,L)
        G= bigraph(V,A)
        G= bigraph(A)
  * Inputs:
      * H, a hash table (Macaulay2Doc), hashtable of edges
      * L, a list (Macaulay2Doc), list of edges
      * V, a list (Macaulay2Doc), list of vertices
      * A, a matrix (Macaulay2Doc), adjacency matrix
  * Optional inputs (Macaulay2Doc),:
      * EntryMode, => ...,
        default value "auto", optional input, accepts 'auto', 'edges', or
        'neighbors'
      * Singletons, =>
        ..., default value null, optional input, accepts the list of isolated
        vertices in a bigraph
  * Outputs:
      * an instance of the type Bigraph,

Description
===========

This is a constructor of a simple graph of class Bigraph.  One
can use the same input types as in graph (Graphs).

+------------------------------------+
|i1 : G = bigraph {{3,4},{1,2},{2,4}}|
|                                    |
|o1 = Bigraph{1 => {2}   }           |
|             2 => {4, 1}            |
|             3 => {4}               |
|             4 => {3, 2}            |
|                                    |
|o1 : Bigraph                        |
+------------------------------------+

See also
========

  * Bigraph -- a graph with bidirected edges and no multiple
    edges

Ways to use bigraph :
=====================

  * "bigraph(HashTable)"
  * "bigraph(List)"
  * "bigraph(List,List)"
  * "bigraph(List,Matrix)"
  * "bigraph(Matrix)"
  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph

For the programmer
==================

The object bigraph, is a method function with options (Macaulay2Doc).

bigraph(...,EntryMode=>...) -- optional input, accepts 'auto', 'edges', or 'neighbors'
**************************************************************************************

Description
===========

The options for EntryMode are 'auto'(the default), 'neighbors' and  'edges'. If
'edges' is selected, then the input should contain a list of lists and the
inner lists correspond to pairs of vertices incident to a given edge. If
'neighbors' is selected, then the input should contain a list of lists and in
the inner lists, the 0th entry is a vertex and the 1st entry is the list of its
neighbors. The default 'auto' option distinguished between the other two
options automatically.

+-----------------------------------------------------------------------+
|i1 : graph ({{a,{b,c,d,e}}, {b,{d,e}}, {e,{a}}},EntryMode=>"neighbors")|
|                                                                       |
|o1 = Graph{a => {e, b, c, d}}                                          |
|           b => {e, a, d}                                              |
|           c => {a}                                                    |
|           d => {a, b}                                                 |
|           e => {a, b}                                                 |
|                                                                       |
|o1 : Graph                                                             |
+-----------------------------------------------------------------------+
|i2 : graph ({{a,{b,c,d,e}}, {b,{d,e}}, {e,{a}}},EntryMode=>"auto")     |
|                                                                       |
|o2 = Graph{a => {e, b, c, d}}                                          |
|           b => {e, a, d}                                              |
|           c => {a}                                                    |
|           d => {a, b}                                                 |
|           e => {a, b}                                                 |
|                                                                       |
|o2 : Graph                                                             |
+-----------------------------------------------------------------------+
|i3 : graph ({{a,b}, {b,d}, {c,d},EntryMode=>"edges"})                  |
|                                                                       |
|o3 = Graph{a => {b}            }                                       |
|           b => {a, d}                                                 |
|           c => {d}                                                    |
|           d => {b, c}                                                 |
|           edges => {EntryMode}                                        |
|           EntryMode => {edges}                                        |
|                                                                       |
|o3 : Graph                                                             |
+-----------------------------------------------------------------------+
|i4 : graph ({{a,b}, {b,d}, {c,d},EntryMode=>"auto"})                   |
|                                                                       |
|o4 = Graph{a => {b}           }                                        |
|           auto => {EntryMode}                                         |
|           b => {a, d}                                                 |
|           c => {d}                                                    |
|           d => {b, c}                                                 |
|           EntryMode => {auto}                                         |
|                                                                       |
|o4 : Graph                                                             |
+-----------------------------------------------------------------------+

Further information
===================

  * Default value: auto
  * Function: bigraph, -- create a bigraph
  * Option key: EntryMode (Graphs), -- Constructs a simple graph

See also
========

  * bigraph -- create a bigraph
  * graph(...,EntryMode=>...) (Graphs) -- Constructs a simple
    graph
  * graph (Graphs) -- Constructs a simple graph

Functions with optional argument named EntryMode :
==================================================

  * bigraph(...,EntryMode=>...)
    -- optional input, accepts
    'auto', 'edges', or 'neighbors'
  * digraph(...,EntryMode=>...) (missing documentation)
  * "graph(...,EntryMode=>...)" -- see graph (Graphs), --
    Constructs a simple graph

bigraph(...,Singletons=>...) -- optional input, accepts the list of isolated vertices in a bigraph
**************************************************************************************************

Description
===========

+--------------------------------------------------------+
|i1 : bigraph({{1,2},{2,3},{3,4}}, Singletons => {5,6,7})|
|                                                        |
|o1 = Bigraph{1 => {2}   }                               |
|             2 => {1, 3}                                |
|             3 => {2, 4}                                |
|             4 => {3}                                   |
|             5 => {}                                    |
|             6 => {}                                    |
|             7 => {}                                    |
|                                                        |
|o1 : Bigraph                                            |
+--------------------------------------------------------+

Further information
===================

  * Default value: null
  * Function: bigraph, -- create a bigraph
  * Option key: Singletons (missing documentation)

See also
========

  * bigraph -- create a bigraph
  * bigraph(...,Singletons=>...)
    -- optional input, accepts
    the list of isolated vertices in a bigraph
  * graph (Graphs) -- Constructs a simple graph

Functions with optional argument named Singletons :
===================================================

  * bigraph(...,Singletons=>...)
    -- optional input, accepts
    the list of isolated vertices in a bigraph
  * digraph(...,Singletons=>...) (missing documentation)
  * "graph(...,Singletons=>...)" -- see graph (Graphs), --
    Constructs a simple graph

bigraph(MixedGraph) -- extract the bigraph component of a mixed graph
*********************************************************************

Synopsis
========

  * Function: bigraph,
  * Usage:
        B=bigraph G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Optional inputs (Macaulay2Doc),:
      * EntryMode, => ...,
        default value "auto", optional input, accepts 'auto', 'edges', or
        'neighbors'
      * Singletons, =>
        ..., default value null, optional input, accepts the list of isolated
        vertices in a bigraph
  * Outputs:
      * an instance of the type Bigraph,

Description
===========

This method extracts the largest component of class Bigraph, of
a mixed graph.

+-----------------------------------------------------------------------------+
|i1 : G= mixedGraph(graph{{a,b},{b,c}},digraph {{a,d},{c,e},{f,g}},bigraph    |
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{d => {e}}}                                |
|                                   e => {d}                                  |
|                Digraph => Digraph{a => {d}}                                 |
|                                   c => {e}                                  |
|                                   d => {}                                   |
|                                   e => {}                                   |
|                                   f => {g}                                  |
|                                   g => {}                                   |
|                Graph => Graph{a => {b}   }                                  |
|                               b => {a, c}                                   |
|                               c => {b}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
|-----------------------------------------------------------------------------|
|{{d,e}})                                                                     |
+-----------------------------------------------------------------------------+
|i2 : bigraph G                                                               |
|                                                                             |
|o2 = Bigraph{d => {e}}                                                       |
|             e => {d}                                                        |
|                                                                             |
|o2 : Bigraph                                                                 |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * digraph(MixedGraph) -- extract the digraph
    component of a mixed graph
  * graph(MixedGraph) -- convert mixed graph to a
    hash table
  * undirectedGraph(MixedGraph) -- extract the
    undirected graph component of a mixed graph

Ways to use this method:
========================

  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph

children(MixedGraph,Thing) -- return the children of a vertex of a mixed graph
******************************************************************************

Synopsis
========

  * Function: children (Graphs),
  * Usage:
        children (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The children of v are the all the vertices u such that v,u is in the directed
edge set of the MixedGraph, G. So the children of a vertex v
are exactly those vertices of the largest digraph component of a  mixed graph
that v points to.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : children (G,1)                                                          |
|                                                                             |
|o2 = set {2}                                                                 |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : children (G,2)                                                          |
|                                                                             |
|o3 = set {3}                                                                 |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i4 : children (G,3)                                                          |
|                                                                             |
|o4 = set {}                                                                  |
|                                                                             |
|o4 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * children (Graphs) -- returns the children of a vertex of a
    digraph
  * parents (Graphs) -- returns the parents of a vertex on a
    digraph
  * parents(MixedGraph,Thing) -- return
    the parents of a vertex of a mixed graph

Ways to use this method:
========================

  * children(MixedGraph,Thing), --
    return the children of a vertex of a mixed graph

collateVertices -- convert a mixed graph into a new mixed graph where each component subgraph has the same set of vertices
**************************************************************************************************************************

Synopsis
========

  * Usage:
        collateVertices(G)
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * an instance of the type MixedGraph,

Description
===========

Let G=mixedGraph(U,D,B) and denote the vertices of U by V1, the vertices of D
by V2 and the vertices of B by  V3. Then the method collateVertices(G) outputs
a mixedGraph with same edges as before but with V1 \cup V2 \cup V3 as the
vertices of U,D and B.

+-----------------------------------------------+
|i1 : U = graph{{1,2},{2,3},{3,4},{1,4},{1,5}}  |
|                                               |
|o1 = Graph{1 => {2, 4, 5}}                     |
|           2 => {1, 3}                         |
|           3 => {2, 4}                         |
|           4 => {1, 3}                         |
|           5 => {1}                            |
|                                               |
|o1 : Graph                                     |
+-----------------------------------------------+
|i2 : D = digraph{{2,1},{3,1},{7,8}}            |
|                                               |
|o2 = Digraph{1 => {} }                         |
|             2 => {1}                          |
|             3 => {1}                          |
|             7 => {8}                          |
|             8 => {}                           |
|                                               |
|o2 : Digraph                                   |
+-----------------------------------------------+
|i3 : B = bigraph{{1,5}}                        |
|                                               |
|o3 = Bigraph{1 => {5}}                         |
|             5 => {1}                          |
|                                               |
|o3 : Bigraph                                   |
+-----------------------------------------------+
|i4 : G = mixedGraph(U,D,B)                     |
|                                               |
|o4 = MixedGraph{Bigraph => Bigraph{1 => {5}}  }|
|                                   5 => {1}    |
|                Digraph => Digraph{1 => {} }   |
|                                   2 => {1}    |
|                                   3 => {1}    |
|                                   7 => {8}    |
|                                   8 => {}     |
|                Graph => Graph{1 => {2, 4, 5}} |
|                               2 => {1, 3}     |
|                               3 => {2, 4}     |
|                               4 => {1, 3}     |
|                               5 => {1}        |
|                                               |
|o4 : MixedGraph                                |
+-----------------------------------------------+
|i5 : collateVertices G                         |
|                                               |
|o5 = MixedGraph{Bigraph => Bigraph{1 => {5}}  }|
|                                   2 => {}     |
|                                   3 => {}     |
|                                   4 => {}     |
|                                   5 => {1}    |
|                                   7 => {}     |
|                                   8 => {}     |
|                Digraph => Digraph{1 => {} }   |
|                                   2 => {1}    |
|                                   3 => {1}    |
|                                   4 => {}     |
|                                   5 => {}     |
|                                   7 => {8}    |
|                                   8 => {}     |
|                Graph => Graph{1 => {2, 4, 5}} |
|                               2 => {1, 3}     |
|                               3 => {2, 4}     |
|                               4 => {1, 3}     |
|                               5 => {1}        |
|                               7 => {}         |
|                               8 => {}         |
|                                               |
|o5 : MixedGraph                                |
+-----------------------------------------------+

Ways to use collateVertices :
=============================

  * "collateVertices(MixedGraph)"

For the programmer
==================

The object collateVertices, is a method function (Macaulay2Doc).

descendants(MixedGraph,Thing) -- return the descendants of a vertex of a mixed graph
************************************************************************************

Synopsis
========

  * Function: descendants (Graphs),
  * Usage:
        descendents (G,v)
        descendants (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The descendants of v are the all the vertices u such that u is reachable from v
in the directed edge set of the MixedGraph, G. Another way to
more intuitively see what the descendants are is to see the descendants of a
vertex v can be found by first taking the children of v. Then if you take the
children of each of the children, and continue the process until the list stops
growing, this will form all the descendants of v.

The output also includes the vertex v from the input in the set of the
descendants.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : descendants (G,1)                                                       |
|                                                                             |
|o2 = set {1, 2, 3}                                                           |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : descendants (G,2)                                                       |
|                                                                             |
|o3 = set {2, 3}                                                              |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i4 : descendants (G,3)                                                       |
|                                                                             |
|o4 = set {3}                                                                 |
|                                                                             |
|o4 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * descendants (Graphs) -- returns the descendants of a
    digraph
  * forefathers (Graphs) -- returns the forefathers of a
    digraph
  * forefathers(MixedGraph,Thing),
    -- return the forefathers of a vertex of a mixed graph
  * nondescendants (Graphs) -- returns the nondescendants
    of a vertex of a digraph
  * nondescendants(MixedGraph,Thing)
    -- return the nondescendents of a
    vertex of a mixed graph

Ways to use this method:
========================

  * descendants(MixedGraph,Thing),
    -- return the descendants of a vertex of a mixed graph

digraph(MixedGraph) -- extract the digraph component of a mixed graph
*********************************************************************

Synopsis
========

  * Function: digraph (Graphs),
  * Usage:
        D=digraph G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Optional inputs (Macaulay2Doc),:
      * EntryMode (missing documentation) => ..., default value "auto", null
      * Singletons (missing documentation) => ..., default value null, null
  * Outputs:
      * a digraph (Graphs),

Description
===========

This method extracts the largest component of class Digraph (Graphs),
of a mixed graph.

+-----------------------------------------------------------------------------+
|i1 : G= mixedGraph(graph{{a,b},{b,c}},digraph {{a,d},{c,e},{f,g}},bigraph    |
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{d => {e}}}                                |
|                                   e => {d}                                  |
|                Digraph => Digraph{a => {d}}                                 |
|                                   c => {e}                                  |
|                                   d => {}                                   |
|                                   e => {}                                   |
|                                   f => {g}                                  |
|                                   g => {}                                   |
|                Graph => Graph{a => {b}   }                                  |
|                               b => {a, c}                                   |
|                               c => {b}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
|-----------------------------------------------------------------------------|
|{{d,e}})                                                                     |
+-----------------------------------------------------------------------------+
|i2 : digraph G                                                               |
|                                                                             |
|o2 = Digraph{a => {d}}                                                       |
|             c => {e}                                                        |
|             d => {}                                                         |
|             e => {}                                                         |
|             f => {g}                                                        |
|             g => {}                                                         |
|                                                                             |
|o2 : Digraph                                                                 |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph
  * graph(MixedGraph) -- convert mixed graph to a
    hash table
  * undirectedGraph(MixedGraph) -- extract the
    undirected graph component of a mixed graph

Ways to use this method:
========================

  * digraph(MixedGraph) -- extract the digraph
    component of a mixed graph

forefathers(MixedGraph,Thing) -- return the forefathers of a vertex of a mixed graph
************************************************************************************

Synopsis
========

  * Function: forefathers (Graphs),
  * Usage:
        foreFathers (G,v)
        foreFathers (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The forefathers of v are the all the vertices u such that v is reachable from u
in the directed edge set of the MixedGraph, G.

The output also includes the vertex v from the input in the set of the
forefathers.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : foreFathers (G,1)                                                       |
|                                                                             |
|o2 = set {1}                                                                 |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : foreFathers (G,2)                                                       |
|                                                                             |
|o3 = set {1, 2}                                                              |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i4 : foreFathers (G,3)                                                       |
|                                                                             |
|o4 = set {1, 2, 3}                                                           |
|                                                                             |
|o4 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * forefathers (Graphs) -- returns the forefathers of a
    digraph
  * descendants (Graphs) -- returns the descendants of a
    digraph
  * descendants(MixedGraph,Thing),
    -- return the descendants of a vertex of a mixed graph

Ways to use this method:
========================

  * forefathers(MixedGraph,Thing),
    -- return the forefathers of a vertex of a mixed graph

graph(MixedGraph) -- convert mixed graph to a hash table
********************************************************

Synopsis
========

  * Function: graph (Graphs),
  * Usage:
        U=graph G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Optional inputs (Macaulay2Doc),:
      * EntryMode (Graphs), => ..., default value "auto", null
      * Singletons (Graphs), => ..., default value null, null
  * Outputs:
      * a hash table (Macaulay2Doc),

Description
===========

This method creates a hash table whose key-value pairs correspond to the
components of G.

+-----------------------------------------------------------------------------+
|i1 : G= mixedGraph(graph{{a,b},{b,c}},digraph {{a,d},{c,e},{f,g}},bigraph    |
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{d => {e}}}                                |
|                                   e => {d}                                  |
|                Digraph => Digraph{a => {d}}                                 |
|                                   c => {e}                                  |
|                                   d => {}                                   |
|                                   e => {}                                   |
|                                   f => {g}                                  |
|                                   g => {}                                   |
|                Graph => Graph{a => {b}   }                                  |
|                               b => {a, c}                                   |
|                               c => {b}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
|-----------------------------------------------------------------------------|
|{{d,e}})                                                                     |
+-----------------------------------------------------------------------------+
|i2 : graph G                                                                 |
|                                                                             |
|o2 = HashTable{Bigraph => Bigraph{d => {e}}}                                 |
|                                  e => {d}                                   |
|               Digraph => Digraph{a => {d}}                                  |
|                                  c => {e}                                   |
|                                  d => {}                                    |
|                                  e => {}                                    |
|                                  f => {g}                                   |
|                                  g => {}                                    |
|               Graph => Graph{a => {b}   }                                   |
|                              b => {a, c}                                    |
|                              c => {b}                                       |
|                                                                             |
|o2 : HashTable                                                               |
+-----------------------------------------------------------------------------+
|i3 : keys (graph G)                                                          |
|                                                                             |
|o3 = {Digraph, Graph, Bigraph}                                               |
|                                                                             |
|o3 : List                                                                    |
+-----------------------------------------------------------------------------+
|i4 : (graph G)#Bigraph === bigraph G                                         |
|                                                                             |
|o4 = true                                                                    |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph
  * digraph(MixedGraph) -- extract the digraph
    component of a mixed graph
  * undirectedGraph(MixedGraph) -- extract the
    undirected graph component of a mixed graph

Ways to use this method:
========================

  * graph(MixedGraph) -- convert mixed graph to a
    hash table

indexLabelGraph(MixedGraph) -- relabel the vertices of a mixed graph according to their indices, indexed from 0
***************************************************************************************************************

Synopsis
========

  * Function: indexLabelGraph (Graphs),
  * Usage:
        G=indexLabelGraph G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * an instance of the type MixedGraph,

Description
===========

This method relabels the vertices of a graph of class MixedGraph,
according to their indices. The method indexes from 0 to the
number of vertices minus one. This is an adaptation of the method
indexLabelGraph (Graphs).

+-----------------------------------------------------------------------------+
|i1 : G= mixedGraph(graph{{a,b},{b,c}},digraph {{a,d},{c,e},{f,g}},bigraph    |
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{d => {e}}}                                |
|                                   e => {d}                                  |
|                Digraph => Digraph{a => {d}}                                 |
|                                   c => {e}                                  |
|                                   d => {}                                   |
|                                   e => {}                                   |
|                                   f => {g}                                  |
|                                   g => {}                                   |
|                Graph => Graph{a => {b}   }                                  |
|                               b => {a, c}                                   |
|                               c => {b}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
|-----------------------------------------------------------------------------|
|{{d,e}})                                                                     |
+-----------------------------------------------------------------------------+
|i2 : indexLabelGraph G                                                       |
|                                                                             |
|o2 = MixedGraph{Bigraph => Bigraph{1 => {2}}}                                |
|                                   2 => {1}                                  |
|                Digraph => Digraph{0 => {2}}                                 |
|                                   1 => {}                                   |
|                                   2 => {}                                   |
|                                   3 => {4}                                  |
|                                   4 => {}                                   |
|                                   5 => {1}                                  |
|                Graph => Graph{0 => {6}   }                                  |
|                               5 => {6}                                      |
|                               6 => {5, 0}                                   |
|                                                                             |
|o2 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * indexLabelGraph (Graphs) -- Relabels the vertices of
    a graph or digraph according to their indices, indexed from 0.

Ways to use this method:
========================

  * indexLabelGraph(MixedGraph), --
    relabel the vertices of a mixed graph according to their indices, indexed
    from 0

isCyclic(MixedGraph) -- check whether a mixed graph contains a directed cycle
*****************************************************************************

Synopsis
========

  * Function: isCyclic (Graphs),
  * Usage:
        isCyclic(G)
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a Boolean value (Macaulay2Doc),

Description
===========

This method checks whether a MixedGraph, is cyclic, i.e.
contains a directed cycle or a cycle on directed edges.

A directed cycle is a cycle in the Digraph (Graphs), constructed
from a mixed graph G by identifying all connected components on bidirected and
undirected edges. Such a connected component contains either bidirected edges
only or undirected edges only.

In the following example, there are no directed cycles.

+-----------------------------------------------+
|i1 : U = graph{{1,2},{2,3},{3,4},{1,4},{1,5}}  |
|                                               |
|o1 = Graph{1 => {2, 4, 5}}                     |
|           2 => {1, 3}                         |
|           3 => {2, 4}                         |
|           4 => {1, 3}                         |
|           5 => {1}                            |
|                                               |
|o1 : Graph                                     |
+-----------------------------------------------+
|i2 : D = digraph{{2,1},{3,1},{7,8}}            |
|                                               |
|o2 = Digraph{1 => {} }                         |
|             2 => {1}                          |
|             3 => {1}                          |
|             7 => {8}                          |
|             8 => {}                           |
|                                               |
|o2 : Digraph                                   |
+-----------------------------------------------+
|i3 : B = bigraph{{1,5}}                        |
|                                               |
|o3 = Bigraph{1 => {5}}                         |
|             5 => {1}                          |
|                                               |
|o3 : Bigraph                                   |
+-----------------------------------------------+
|i4 : G = mixedGraph(U,D,B)                     |
|                                               |
|o4 = MixedGraph{Bigraph => Bigraph{1 => {5}}  }|
|                                   5 => {1}    |
|                Digraph => Digraph{1 => {} }   |
|                                   2 => {1}    |
|                                   3 => {1}    |
|                                   7 => {8}    |
|                                   8 => {}     |
|                Graph => Graph{1 => {2, 4, 5}} |
|                               2 => {1, 3}     |
|                               3 => {2, 4}     |
|                               4 => {1, 3}     |
|                               5 => {1}        |
|                                               |
|o4 : MixedGraph                                |
+-----------------------------------------------+
|i5 : isCyclic G                                |
|                                               |
|o5 = false                                     |
+-----------------------------------------------+

In the next example, there are no cycles inside the digraph of the mixed graph,
but there is a directed cycle after you identify the vertices {1,2} and {3,4}.

+---------------------------------------------+
|i6 : U = graph{{1,2},{3,4}}                  |
|                                             |
|o6 = Graph{1 => {2}}                         |
|           2 => {1}                          |
|           3 => {4}                          |
|           4 => {3}                          |
|                                             |
|o6 : Graph                                   |
+---------------------------------------------+
|i7 : D = digraph{{1,3},{4,2}}                |
|                                             |
|o7 = Digraph{1 => {3}}                       |
|             2 => {}                         |
|             3 => {}                         |
|             4 => {2}                        |
|                                             |
|o7 : Digraph                                 |
+---------------------------------------------+
|i8 : G = mixedGraph(U,D)                     |
|                                             |
|o8 = MixedGraph{Bigraph => Bigraph{}        }|
|                Digraph => Digraph{1 => {3}} |
|                                   2 => {}   |
|                                   3 => {}   |
|                                   4 => {2}  |
|                Graph => Graph{1 => {2}}     |
|                               2 => {1}      |
|                               3 => {4}      |
|                               4 => {3}      |
|                                             |
|o8 : MixedGraph                              |
+---------------------------------------------+
|i9 : isCyclic G                              |
|                                             |
|o9 = true                                    |
+---------------------------------------------+

This is a similar example as before, but now the vertices {1,2} are connected
by an undirected edge and {3,4} by a bidirected edge.

+----------------------------------------------+
|i10 : U = graph{{1,2}}                        |
|                                              |
|o10 = Graph{1 => {2}}                         |
|            2 => {1}                          |
|                                              |
|o10 : Graph                                   |
+----------------------------------------------+
|i11 : B = bigraph{{3,4}}                      |
|                                              |
|o11 = Bigraph{3 => {4}}                       |
|              4 => {3}                        |
|                                              |
|o11 : Bigraph                                 |
+----------------------------------------------+
|i12 : D = digraph{{1,3},{4,2}}                |
|                                              |
|o12 = Digraph{1 => {3}}                       |
|              2 => {}                         |
|              3 => {}                         |
|              4 => {2}                        |
|                                              |
|o12 : Digraph                                 |
+----------------------------------------------+
|i13 : G = mixedGraph(U,D,B)                   |
|                                              |
|o13 = MixedGraph{Bigraph => Bigraph{3 => {4}}}|
|                                    4 => {3}  |
|                 Digraph => Digraph{1 => {3}} |
|                                    2 => {}   |
|                                    3 => {}   |
|                                    4 => {2}  |
|                 Graph => Graph{1 => {2}}     |
|                                2 => {1}      |
|                                              |
|o13 : MixedGraph                              |
+----------------------------------------------+
|i14 : isCyclic G                              |
|                                              |
|o14 = true                                    |
+----------------------------------------------+

In the following example, there is a cycle on the directed edges that is inside
a connected undirected component.

+--------------------------------------------------------+
|i15 : G = mixedGraph(graph{{1,2}},digraph {{1,2},{2,1}})|
|                                                        |
|o15 = MixedGraph{Bigraph => Bigraph{}        }          |
|                 Digraph => Digraph{1 => {2}}           |
|                                    2 => {1}            |
|                 Graph => Graph{1 => {2}}               |
|                                2 => {1}                |
|                                                        |
|o15 : MixedGraph                                        |
+--------------------------------------------------------+
|i16 : isCyclic G                                        |
|                                                        |
|o16 = true                                              |
+--------------------------------------------------------+

Ways to use this method:
========================

  * isCyclic(MixedGraph) -- check whether a
    mixed graph contains a directed cycle

isLoopless -- check whether a graph contains a loop
***************************************************

Synopsis
========

  * Usage:
        isLoopless(G)
  * Inputs:
      * G, graph of class  MixedGraph,  Graph (Graphs),
        see Digraph (Graphs), or  Bigraph,
  * Outputs:
      * a Boolean value (Macaulay2Doc),

Description
===========

This method checks whether a graph contains a loop.

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

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

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 :
========================

  * "isLoopless(Bigraph)"
  * "isLoopless(Digraph)"
  * "isLoopless(Graph)"
  * "isLoopless(MixedGraph)"

For the programmer
==================

The object isLoopless, is a method function (Macaulay2Doc).

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

Synopsis
========

  * Function: isSimple (Graphs),
  * Usage:
        isSimple(G)
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a Boolean value (Macaulay2Doc),

Description
===========

This method checks whether a graph is simple: does not contain loops or
multiple edges. Note that since graph (Graphs), digraph (Graphs),
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                                      |
+-------------------------------------------------+

Ways to use this method:
========================

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

MixedGraph -- a graph that has undirected, directed and bidirected edges
************************************************************************

Description
===========

MixedGraph is a graph that has undirected, directed and bidirected edges. To
create a mixed graph, use mixedGraph. Each type of subgraph
(undirected, directed and bidirected) does not have multiple edges and can
appear at most once.

See also
========

  * mixedGraph -- create a mixed graph from a combination of
    undirected graph, digraph and bigraph
  * collateVertices -- convert a mixed graph into a new
    mixed graph where each component subgraph has the same set of vertices

Functions and methods returning an object of class MixedGraph :
===============================================================

  * collateVertices -- convert a mixed graph into a new
    mixed graph where each component subgraph has the same set of vertices
  * indexLabelGraph(MixedGraph), --
    relabel the vertices of a mixed graph according to their indices, indexed
    from 0
  * mixedGraph -- create a mixed graph from a combination of
    undirected graph, digraph and bigraph

Methods that use an object of class MixedGraph :
================================================

  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph
  * children(MixedGraph,Thing), --
    return the children of a vertex of a mixed graph
  * "collateVertices(MixedGraph)" -- see collateVertices,
    -- convert a mixed graph into a new mixed graph where each
    component subgraph has the same set of vertices
  * descendants(MixedGraph,Thing),
    -- return the descendants of a vertex of a mixed graph
  * digraph(MixedGraph) -- extract the digraph
    component of a mixed graph
  * forefathers(MixedGraph,Thing),
    -- return the forefathers of a vertex of a mixed graph
  * graph(MixedGraph) -- convert mixed graph to a
    hash table
  * isCyclic(MixedGraph) -- check whether a
    mixed graph contains a directed cycle
  * "isLoopless(MixedGraph)" -- see isLoopless, -- check
    whether a graph contains a loop
  * isSimple(MixedGraph) -- check whether a
    mixed graph is simple
  * neighbors(MixedGraph,Thing), --
    return the neighbors of a vertex of a mixed graph
  * net(MixedGraph) -- print a mixed graph as a
    net
  * nondescendants(MixedGraph,Thing)
    -- return the nondescendents of a
    vertex of a mixed graph
  * nonneighbors(MixedGraph,Thing),
    -- return the neighbors of a vertex of a mixed graph
  * parents(MixedGraph,Thing) -- return
    the parents of a vertex of a mixed graph
  * "partitionLMG(MixedGraph)" -- see partitionLMG, --
    partition the vertices of a loopless mixed graph into adjacent to
    undirected edges and adjacent to bidirected edges
  * toString(MixedGraph) -- print a mixed
    graph as a string
  * "undirectedGraph(MixedGraph)" -- see undirectedGraph,
    -- extract the undirected graph component of a mixed graph
  * "vertexSet(MixedGraph)" -- see vertices(MixedGraph),
    -- create a union of all vertices of a mixed
    graph
  * vertices(MixedGraph) -- create a union of
    all vertices of a mixed graph

For the programmer
==================

The object MixedGraph, is a type (Macaulay2Doc),
with ancestor classes HashTable (Macaulay2Doc), < Thing (Macaulay2Doc).

mixedGraph -- create a mixed graph from a combination of undirected graph, digraph and bigraph
**********************************************************************************************

Synopsis
========

  * Usage:
        G= mixedGraph(U, D, B)
        G= mixedGraph G
        G= mixedGraph D
        G= mixedGraph B
        G= mixedGraph(G, D)
        G= mixedGraph(G, B)
        G= mixedGraph(D, B)
  * Inputs:
      * U, a graph (Graphs), component that contains all
        undirected edges of the graph
      * D, a digraph (Graphs), component that contains all
        directed edges of the graph
      * B, an instance of the type Bigraph, component that
        contains all bidirected edges of the graph
  * Outputs:
      * an instance of the type MixedGraph,

Description
===========

This is a constructor of graphs of class MixedGraph, from a
combination of subgraphs of classes Graph (Graphs), Digraph (Graphs),
and Bigraph.  One can also input any subset
and any permutation of the arguments. Each type of subgraph can appear at most
once.

Note that this constructor does not check the input satisfies the properties of
loopless mixed graphs from Sadeghi and Lauritzen, 2020
<https://arxiv.org/pdf/1109.5909.pdf>.

+-----------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{1,2}},digraph {{1,3},{2,3}},bigraph {{3,4}})|
|                                                                       |
|o1 = MixedGraph{Bigraph => Bigraph{3 => {4}}}                          |
|                                   4 => {3}                            |
|                Digraph => Digraph{1 => {3}}                           |
|                                   2 => {3}                            |
|                                   3 => {}                             |
|                Graph => Graph{1 => {2}}                               |
|                               2 => {1}                                |
|                                                                       |
|o1 : MixedGraph                                                        |
+-----------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges

Ways to use mixedGraph :
========================

  * "mixedGraph(Bigraph)"
  * "mixedGraph(Bigraph,Digraph)"
  * "mixedGraph(Bigraph,Digraph,Graph)"
  * "mixedGraph(Bigraph,Graph)"
  * "mixedGraph(Bigraph,Graph,Digraph)"
  * "mixedGraph(Digraph)"
  * "mixedGraph(Digraph,Bigraph)"
  * "mixedGraph(Digraph,Bigraph,Graph)"
  * "mixedGraph(Digraph,Graph)"
  * "mixedGraph(Digraph,Graph,Bigraph)"
  * "mixedGraph(Graph)"
  * "mixedGraph(Graph,Bigraph)"
  * "mixedGraph(Graph,Bigraph,Digraph)"
  * "mixedGraph(Graph,Digraph)"
  * "mixedGraph(Graph,Digraph,Bigraph)"

For the programmer
==================

The object mixedGraph, is a method function (Macaulay2Doc).

neighbors(MixedGraph,Thing) -- return the neighbors of a vertex of a mixed graph
********************************************************************************

Synopsis
========

  * Function: neighbors (Graphs),
  * Usage:
        neighbors (G,v)
        neighbors (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The neighbors of v are the all the vertices u such that u,v is an undirected
edge in G.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : neighbors (G,1)                                                         |
|                                                                             |
|o2 = set {3}                                                                 |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : neighbors (G,2)                                                         |
|                                                                             |
|o3 = set {}                                                                  |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * neighbors (Graphs) -- returns the neighbors of a vertex in
    a graph
  * nonneighbors (Graphs) -- returns the non-neighbors of a
    vertex in a graph
  * nonneighbors(MixedGraph,Thing),
    -- return the neighbors of a vertex of a mixed graph

Ways to use this method:
========================

  * neighbors(MixedGraph,Thing), --
    return the neighbors of a vertex of a mixed graph

net(MixedGraph) -- print a mixed graph as a  net
************************************************

Synopsis
========

  * Function: net (Macaulay2Doc),
  * Usage:
        net G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a net (Macaulay2Doc),

Description
===========

This methods defines how to manipulate a mixed graph to produce a  Net (Macaulay2Doc),

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : net G                                                                   |
|                                                                             |
|o2 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * toString(MixedGraph) -- print a mixed
    graph as a string
  * Net (Macaulay2Doc) -- the class of all nets and strings

Ways to use this method:
========================

  * net(MixedGraph) -- print a mixed graph as a
    net

nondescendants(MixedGraph,Thing) -- return the nondescendents of a vertex of a mixed graph
******************************************************************************************

Synopsis
========

  * Function: nondescendants (Graphs),
  * Usage:
        nondescendents (G,v)
        nondescendants (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The nondescendant  of v are the all the vertices u such that u is not reachable
from v in the directed edge set of the MixedGraph, G.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : nondescendants (G,1)                                                    |
|                                                                             |
|o2 = set {4}                                                                 |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : nondescendants (G,2)                                                    |
|                                                                             |
|o3 = set {1, 4}                                                              |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i4 : nondescendants (G,3)                                                    |
|                                                                             |
|o4 = set {1, 2, 4}                                                           |
|                                                                             |
|o4 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * nondescendants (Graphs) -- returns the nondescendants
    of a vertex of a digraph
  * descendants (Graphs) -- returns the descendants of a
    digraph
  * descendants(MixedGraph,Thing),
    -- return the descendants of a vertex of a mixed graph

Ways to use this method:
========================

  * nondescendants(MixedGraph,Thing)
    -- return the nondescendents of a
    vertex of a mixed graph

nonneighbors(MixedGraph,Thing) -- return the neighbors of a vertex of a mixed graph
***********************************************************************************

Synopsis
========

  * Function: nonneighbors (Graphs),
  * Usage:
        nonneighbors (G,v)
        nonneighbors (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The nonneighbors of v are the all the vertices u such that u,v is not an
undirected edge in G.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : nonneighbors (G,1)                                                      |
|                                                                             |
|o2 = set {2, 4}                                                              |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : nonneighbors (G,2)                                                      |
|                                                                             |
|o3 = set {1, 3, 4}                                                           |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * nonneighbors (Graphs) -- returns the non-neighbors of a
    vertex in a graph
  * neighbors (Graphs) -- returns the neighbors of a vertex in
    a graph
  * neighbors(MixedGraph,Thing), --
    return the neighbors of a vertex of a mixed graph

Ways to use this method:
========================

  * nonneighbors(MixedGraph,Thing),
    -- return the neighbors of a vertex of a mixed graph

parents(MixedGraph,Thing) -- return the parents of a vertex of a mixed graph
****************************************************************************

Synopsis
========

  * Function: parents (Graphs),
  * Usage:
        parents (G,v)
  * Inputs:
      * G, an instance of the type MixedGraph,
      * v, a thing (Macaulay2Doc), a vertex of G
  * Outputs:
      * a set (Macaulay2Doc),

Description
===========

The parents of v are the all the vertices u such that u,v is in the directed
edge set of the MixedGraph, G. So the parents of a vertex v
are exactly those vertices of the largest digraph component of a mixed graph
that point to v.

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : parents (G,1)                                                           |
|                                                                             |
|o2 = set {}                                                                  |
|                                                                             |
|o2 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i3 : parents (G,2)                                                           |
|                                                                             |
|o3 = set {1}                                                                 |
|                                                                             |
|o3 : Set                                                                     |
+-----------------------------------------------------------------------------+
|i4 : parents (G,3)                                                           |
|                                                                             |
|o4 = set {2}                                                                 |
|                                                                             |
|o4 : Set                                                                     |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * parents (Graphs) -- returns the parents of a vertex on a
    digraph
  * children (Graphs) -- returns the children of a vertex of a
    digraph
  * children(MixedGraph,Thing), --
    return the children of a vertex of a mixed graph

Ways to use this method:
========================

  * parents(MixedGraph,Thing) -- return
    the parents of a vertex of a mixed graph

partitionLMG -- partition the vertices of a loopless mixed graph into adjacent to undirected edges and adjacent to bidirected edges
***********************************************************************************************************************************

Synopsis
========

  * Usage:
        partitionLMG(G)
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a sequence (Macaulay2Doc), (U,W) where U are vertices
        adjacent to undirected edges and W are vertices adjacent to bidirected
        edges

Description
===========

This function makes a partition $U\cup W$ of the vertices V of a loopless mixed
graph such that:

- if $i-j$ in $G$ then $i,j\in U$,

- if $i\leftarrow \rightarrow j$ in $G$ then $i,j\in W$

- there is no directed edge $i\to j$ in $G$ such that $i\in W$ and $j\in U$.

These conditions are equivalent to those introduced in Seth Sullivant, Kelli
Talaska, and Jan Draisma, Trek separation for Gaussian graphical models, The
Annals of Statistics 38.3 (2010): 1665-1685.

For technical purposes we assume, without loss of generality, that vertices in
the LMG are ordered such that:

1. all vertices in U come before vertices in W,

2. if there is a directed edge from $i$ to $j$, then $i<j$.

This method checks that the input contains no loops and it requires the graph
to be directed acyclic, i.e., there should not be any directed cycles after the
identification of the connected undirected and bidirected components.

+------------------------------------------------+
|i1 : U = graph{{1,2},{2,3},{1,3}}               |
|                                                |
|o1 = Graph{1 => {2, 3}}                         |
|           2 => {1, 3}                          |
|           3 => {1, 2}                          |
|                                                |
|o1 : Graph                                      |
+------------------------------------------------+
|i2 : D = digraph{{1,4},{3,7}}                   |
|                                                |
|o2 = Digraph{1 => {4}}                          |
|             3 => {7}                           |
|             4 => {}                            |
|             7 => {}                            |
|                                                |
|o2 : Digraph                                    |
+------------------------------------------------+
|i3 : B = bigraph{{4,5},{5,6},{7,8}}             |
|                                                |
|o3 = Bigraph{4 => {5}   }                       |
|             5 => {4, 6}                        |
|             6 => {5}                           |
|             7 => {8}                           |
|             8 => {7}                           |
|                                                |
|o3 : Bigraph                                    |
+------------------------------------------------+
|i4 : G = mixedGraph(U,D,B)                      |
|                                                |
|o4 = MixedGraph{Bigraph => Bigraph{4 => {5}   }}|
|                                   5 => {4, 6}  |
|                                   6 => {5}     |
|                                   7 => {8}     |
|                                   8 => {7}     |
|                Digraph => Digraph{1 => {4}}    |
|                                   3 => {7}     |
|                                   4 => {}      |
|                                   7 => {}      |
|                Graph => Graph{1 => {2, 3}}     |
|                               2 => {1, 3}      |
|                               3 => {1, 2}      |
|                                                |
|o4 : MixedGraph                                 |
+------------------------------------------------+
|i5 : partitionLMG G                             |
|                                                |
|o5 = ({1, 2, 3}, {4, 5, 6, 7, 8})               |
|                                                |
|o5 : Sequence                                   |
+------------------------------------------------+

The vertices that are adjacent only to directed edges are sorted depending on
their order. If  v  is such a vertex and v < max U, then v is added to U.
Otherwise, it is added to W.

+------------------------------------------------+
|i6 : U = graph{{2,3},{3,4},{4,2}}               |
|                                                |
|o6 = Graph{2 => {3, 4}}                         |
|           3 => {2, 4}                          |
|           4 => {2, 3}                          |
|                                                |
|o6 : Graph                                      |
+------------------------------------------------+
|i7 : D = digraph{{1,2},{2,5},{4,9}}             |
|                                                |
|o7 = Digraph{1 => {2}}                          |
|             2 => {5}                           |
|             4 => {9}                           |
|             5 => {}                            |
|             9 => {}                            |
|                                                |
|o7 : Digraph                                    |
+------------------------------------------------+
|i8 : B = bigraph{{5,6},{6,7},{8,9}}             |
|                                                |
|o8 = Bigraph{5 => {6}   }                       |
|             6 => {5, 7}                        |
|             7 => {6}                           |
|             8 => {9}                           |
|             9 => {8}                           |
|                                                |
|o8 : Bigraph                                    |
+------------------------------------------------+
|i9 : G = mixedGraph(U,D,B)                      |
|                                                |
|o9 = MixedGraph{Bigraph => Bigraph{5 => {6}   }}|
|                                   6 => {5, 7}  |
|                                   7 => {6}     |
|                                   8 => {9}     |
|                                   9 => {8}     |
|                Digraph => Digraph{1 => {2}}    |
|                                   2 => {5}     |
|                                   4 => {9}     |
|                                   5 => {}      |
|                                   9 => {}      |
|                Graph => Graph{2 => {3, 4}}     |
|                               3 => {2, 4}      |
|                               4 => {2, 3}      |
|                                                |
|o9 : MixedGraph                                 |
+------------------------------------------------+
|i10 : partitionLMG G                            |
|                                                |
|o10 = ({1, 2, 3, 4}, {5, 6, 7, 8, 9})           |
|                                                |
|o10 : Sequence                                  |
+------------------------------------------------+
+-------------------------------------------------+
|i11 : U = graph{{1,2},{2,3},{1,3}}               |
|                                                 |
|o11 = Graph{1 => {2, 3}}                         |
|            2 => {1, 3}                          |
|            3 => {1, 2}                          |
|                                                 |
|o11 : Graph                                      |
+-------------------------------------------------+
|i12 : D = digraph{{1,4},{3,7},{8,9}}             |
|                                                 |
|o12 = Digraph{1 => {4}}                          |
|              3 => {7}                           |
|              4 => {}                            |
|              7 => {}                            |
|              8 => {9}                           |
|              9 => {}                            |
|                                                 |
|o12 : Digraph                                    |
+-------------------------------------------------+
|i13 : B = bigraph{{4,5},{5,6},{7,9}}             |
|                                                 |
|o13 = Bigraph{4 => {5}   }                       |
|              5 => {4, 6}                        |
|              6 => {5}                           |
|              7 => {9}                           |
|              9 => {7}                           |
|                                                 |
|o13 : Bigraph                                    |
+-------------------------------------------------+
|i14 : G = mixedGraph(U,D,B)                      |
|                                                 |
|o14 = MixedGraph{Bigraph => Bigraph{4 => {5}   }}|
|                                    5 => {4, 6}  |
|                                    6 => {5}     |
|                                    7 => {9}     |
|                                    9 => {7}     |
|                 Digraph => Digraph{1 => {4}}    |
|                                    3 => {7}     |
|                                    4 => {}      |
|                                    7 => {}      |
|                                    8 => {9}     |
|                                    9 => {}      |
|                 Graph => Graph{1 => {2, 3}}     |
|                                2 => {1, 3}      |
|                                3 => {1, 2}      |
|                                                 |
|o14 : MixedGraph                                 |
+-------------------------------------------------+
|i15 : partitionLMG G                             |
|                                                 |
|o15 = ({1, 2, 3}, {4, 5, 6, 7, 8, 9})            |
|                                                 |
|o15 : Sequence                                   |
+-------------------------------------------------+

Ways to use partitionLMG :
==========================

  * "partitionLMG(MixedGraph)"

For the programmer
==================

The object partitionLMG, is a method function (Macaulay2Doc).

toString(MixedGraph) -- print a mixed graph as a string
*******************************************************

Synopsis
========

  * Function: toString (Macaulay2Doc),
  * Usage:
        toString G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a string (Macaulay2Doc),

Description
===========

This methods defines how to manipulate a mixed graph to produce a
String (Macaulay2Doc),

+-----------------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4},{2,4}})|
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{2 => {4}   }}                             |
|                                   3 => {4}                                  |
|                                   4 => {3, 2}                               |
|                Digraph => Digraph{1 => {2}}                                 |
|                                   2 => {3}                                  |
|                                   3 => {}                                   |
|                Graph => Graph{1 => {3}}                                     |
|                               3 => {1}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
+-----------------------------------------------------------------------------+
|i2 : toString G                                                              |
|                                                                             |
|o2 = new HashTable from {Digraph => digraph ({1, 2, 3}, {{1, 2}, {2, 3}}),   |
|     Graph => graph ({3, 1}, {{1, 3}}), Bigraph => bigraph ({3, 4, 2}, {{4,  |
|     3}, {4, 2}})}                                                           |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * net(MixedGraph) -- print a mixed graph as a
    net
  * String (Macaulay2Doc) -- the class of all strings

Ways to use this method:
========================

  * toString(MixedGraph) -- print a mixed
    graph as a string

undirectedGraph -- extract the undirected graph component of a mixed graph
**************************************************************************

Synopsis
========

  * Usage:
        U=undirectedGraph G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a graph (Graphs),

Description
===========

This method extracts the largest component of class Graph (Graphs),
of a mixed graph.

+-----------------------------------------------------------------------------+
|i1 : G= mixedGraph(graph{{a,b},{b,c}},digraph {{a,d},{c,e},{f,g}},bigraph    |
|                                                                             |
|o1 = MixedGraph{Bigraph => Bigraph{d => {e}}}                                |
|                                   e => {d}                                  |
|                Digraph => Digraph{a => {d}}                                 |
|                                   c => {e}                                  |
|                                   d => {}                                   |
|                                   e => {}                                   |
|                                   f => {g}                                  |
|                                   g => {}                                   |
|                Graph => Graph{a => {b}   }                                  |
|                               b => {a, c}                                   |
|                               c => {b}                                      |
|                                                                             |
|o1 : MixedGraph                                                              |
|-----------------------------------------------------------------------------|
|{{d,e}})                                                                     |
+-----------------------------------------------------------------------------+
|i2 : undirectedGraph G                                                       |
|                                                                             |
|o2 = Graph{a => {b}   }                                                      |
|           b => {a, c}                                                       |
|           c => {b}                                                          |
|                                                                             |
|o2 : Graph                                                                   |
+-----------------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges
  * bigraph(MixedGraph) -- extract the bigraph
    component of a mixed graph
  * digraph(MixedGraph) -- extract the digraph
    component of a mixed graph
  * graph(MixedGraph) -- convert mixed graph to a
    hash table

Ways to use undirectedGraph :
=============================

  * "undirectedGraph(MixedGraph)"

For the programmer
==================

The object undirectedGraph, is a method function (Macaulay2Doc).

vertices(MixedGraph) -- create a union of all vertices of a mixed graph
***********************************************************************

Synopsis
========

  * Function: vertices (Polyhedra),
  * Usage:
        V=vertices G
        V=vertexSet G
  * Inputs:
      * G, an instance of the type MixedGraph,
  * Outputs:
      * a list (Macaulay2Doc),

Description
===========

This function creates a union of all vertices of a graph of class
MixedGraph. This is an adaptation of vertices and vertexSet from
Graphs.

+-----------------------------------------------------------------------+
|i1 : G = mixedGraph(graph{{3,1}},digraph {{1,2},{2,3}},bigraph {{3,4}})|
|                                                                       |
|o1 = MixedGraph{Bigraph => Bigraph{3 => {4}}}                          |
|                                   4 => {3}                            |
|                Digraph => Digraph{1 => {2}}                           |
|                                   2 => {3}                            |
|                                   3 => {}                             |
|                Graph => Graph{1 => {3}}                               |
|                               3 => {1}                                |
|                                                                       |
|o1 : MixedGraph                                                        |
+-----------------------------------------------------------------------+
|i2 : vertices G                                                        |
|                                                                       |
|o2 = {1, 2, 3, 4}                                                      |
|                                                                       |
|o2 : List                                                              |
+-----------------------------------------------------------------------+
|i3 : vertexSet G                                                       |
|                                                                       |
|o3 = {1, 2, 3, 4}                                                      |
|                                                                       |
|o3 : List                                                              |
+-----------------------------------------------------------------------+

See also
========

  * MixedGraph -- a graph that has undirected, directed and
    bidirected edges

Ways to use this method:
========================

  * vertices(MixedGraph) -- create a union of
    all vertices of a mixed graph