Macaulay2 » Documentation
Packages » Graphs :: directProduct
next | previous | forward | backward | up | index | toc

# directProduct -- Computes the direct product of two graphs

- Usage:
    `F = directProduct(G,H)`
- Inputs:
  - G, a graph,
  - H, a graph,
- Outputs:
  - F, a graph, The Direct Product of G and H

## Description

This method will take in any two graphs and output the direct product of these two graphs. The vertex set of the direct product of G and H is the cartesian product of G and H's vertex sets. The keys for each vertex will be output as a sequence to represent this. Any two vertices (u,u') and (v,v') form an edge in the direct product of G and G if and only if u' is adjacent with v' and u is adjacent with v in the original graphs.

    i1 : G = graph({1,2},{{1,2}});

    i2 : H = graph({3,4,5},{{3,4},{4,5}});

    i3 : G'= directProduct(G,H)

    o3 = Graph{(1, 3) => {(2, 4)}        }
               (1, 4) => {(2, 5), (2, 3)}
               (1, 5) => {(2, 4)}
               (2, 3) => {(1, 4)}
               (2, 4) => {(1, 3), (1, 5)}
               (2, 5) => {(1, 4)}

    o3 : Graph

## See also

- graphComposition -- A method for composing two graphs
- strongProduct -- a method for taking the strong product of two graphs
- cartesianProduct -- Computes the cartesian product of two graphs

## Ways to use directProduct:

- `directProduct(Graph,Graph)`
- `directProduct(List)` -- see directProduct -- direct product
- `directProduct(Sequence)` -- see directProduct -- direct product
- directProduct(Cone,Cone) -- computes the direct product of polyhedra and cones
- `directProduct(Cone,Polyhedron)` -- see directProduct(Cone,Cone) -- computes the direct product of polyhedra and cones
- `directProduct(Polyhedron,Cone)` -- see directProduct(Cone,Cone) -- computes the direct product of polyhedra and cones
- `directProduct(Polyhedron,Polyhedron)` -- see directProduct(Cone,Cone) -- computes the direct product of polyhedra and cones
- directProduct(Fan,Fan) -- computes the direct product of two fans

## For the programmer

The object directProduct is an associative binary method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:4813:0.