An incidence structure is specified by a list of points, blocks, and an incidence matrix ([1], [2]).
REFERENCES:
[1]  Block designs and incidence structures from wikipedia, Wikipedia article Block_design Wikipedia article Incidence_structure 
[2] 

AUTHORS:
Peter Dobcsanyi and David Joyner (20072008)
This is a significantly modified form of part of the module block_design.py (version 0.6) written by Peter Dobcsanyi peter@designtheory.org.
Bases: object
This the base class for block designs.
Returns the subgroup of the automorphism group of the incidence graph which respects the P B partition. It is (isomorphic to) the automorphism group of the block design, although the degrees differ.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: G = BD.automorphism_group(); G
Permutation Group with generators [(4,5)(6,7), (4,6)(5,7), (2,3)(6,7), (2,4)(3,5), (1,2)(5,6)]
sage: BD = BlockDesign(4,[[0],[0,1],[1,2],[3,3]],test=False)
sage: G = BD.automorphism_group(); G
Permutation Group with generators [()]
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: G = BD.automorphism_group(); G
Permutation Group with generators [(4,5)(6,7), (4,6)(5,7), (2,3)(6,7), (2,4)(3,5), (1,2)(5,6)]
This is not a wrapper for GAP Design’s IsBlockDesign. The GAP Design function IsBlockDesign http://www.gapsystem.org/Manuals/pkg/design/htm/CHAP004.htm apparently simply checks the record structure and no mathematical properties. Instead, the function below checks some necessary (but not sufficient) “easy” identities arising from the identity.
INPUT:
WARNING: This is very fast but can return false positives.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.is_block_design()
(True, [2, 7, 3, 1])
sage: BD.block_design_checker(2, 7, 3, 1)
True
sage: BD.block_design_checker(2, 7, 3, 1,"binary")
True
sage: BD.block_design_checker(2, 7, 3, 1,"connected")
True
sage: BD.block_design_checker(2, 7, 3, 1,"simple")
True
Return a list of block’s sizes.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.block_sizes()
[3, 3, 3, 3, 3, 3, 3]
Return the list of blocks.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.blocks()
[[0, 1, 2], [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6], [2, 4, 5]]
Returns the dual of the incidence structure.
Note that the dual of a block design may not be a block design.
INPUT:
algorithm – whether to use Sage’s implementation (algorithm=None, default) or use GAP’s (algorithm="gap").
Note
The algorithm="gap" option requires GAP’s Design package (included in the gap_packages Sage spkg).
Also can be called with dual_design.
EXAMPLES:
The dual of a projective plane is a projective plane:
sage: PP = designs.ProjectivePlaneDesign(4)
sage: PP.dual_design().is_block_design()
(True, [2, 21, 5, 1])
sage: PP = designs.ProjectivePlaneDesign(4) # optional  gap_packages
sage: PP.dual_design(algorithm="gap").is_block_design() # optional  gap_packages
(True, [2, 21, 5, 1])
TESTS:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: D = BlockDesign(4, [[0,2],[1,2,3],[2,3]], test=False)
sage: D
Incidence structure with 4 points and 3 blocks
sage: D.dual_design()
Incidence structure with 3 points and 4 blocks
sage: print D.dual_design(algorithm="gap") # optional  gap_packages
IncidenceStructure<points=[0, 1, 2], blocks=[[0], [0, 1, 2], [1], [1, 2]]>
sage: BD = IncidenceStructure(range(7),[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]], name="FanoPlane")
sage: BD
Incidence structure with 7 points and 7 blocks
sage: print BD.dual_design(algorithm="gap") # optional  gap_packages
IncidenceStructure<points=[0, 1, 2, 3, 4, 5, 6], blocks=[[0, 1, 2], [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6], [2, 4, 5]]>
sage: BD.dual_incidence_structure()
Incidence structure with 7 points and 7 blocks
REFERENCE:
Returns the dual of the incidence structure.
Note that the dual of a block design may not be a block design.
INPUT:
algorithm – whether to use Sage’s implementation (algorithm=None, default) or use GAP’s (algorithm="gap").
Note
The algorithm="gap" option requires GAP’s Design package (included in the gap_packages Sage spkg).
Also can be called with dual_design.
EXAMPLES:
The dual of a projective plane is a projective plane:
sage: PP = designs.ProjectivePlaneDesign(4)
sage: PP.dual_design().is_block_design()
(True, [2, 21, 5, 1])
sage: PP = designs.ProjectivePlaneDesign(4) # optional  gap_packages
sage: PP.dual_design(algorithm="gap").is_block_design() # optional  gap_packages
(True, [2, 21, 5, 1])
TESTS:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: D = BlockDesign(4, [[0,2],[1,2,3],[2,3]], test=False)
sage: D
Incidence structure with 4 points and 3 blocks
sage: D.dual_design()
Incidence structure with 3 points and 4 blocks
sage: print D.dual_design(algorithm="gap") # optional  gap_packages
IncidenceStructure<points=[0, 1, 2], blocks=[[0], [0, 1, 2], [1], [1, 2]]>
sage: BD = IncidenceStructure(range(7),[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]], name="FanoPlane")
sage: BD
Incidence structure with 7 points and 7 blocks
sage: print BD.dual_design(algorithm="gap") # optional  gap_packages
IncidenceStructure<points=[0, 1, 2, 3, 4, 5, 6], blocks=[[0, 1, 2], [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6], [2, 4, 5]]>
sage: BD.dual_incidence_structure()
Incidence structure with 7 points and 7 blocks
REFERENCE:
Returns the incidence graph of the design, where the incidence matrix of the design is the adjacency matrix of the graph.
EXAMPLE:
sage: BD = IncidenceStructure(range(7),[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.incidence_graph()
Bipartite graph on 14 vertices
sage: A = BD.incidence_matrix()
sage: Graph(block_matrix([[A*0,A],[A.transpose(),A*0]])) == BD.incidence_graph()
True
REFERENCE:
Return the incidence matrix \(A\) of the design. A is a \((v imes b)\) matrix defined by: A[i,j] = 1 if i is in block B_j and 0 otherwise.
EXAMPLES:
sage: BD = IncidenceStructure(range(7),[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.block_sizes()
[3, 3, 3, 3, 3, 3, 3]
sage: BD.incidence_matrix()
[1 1 1 0 0 0 0]
[1 0 0 1 1 0 0]
[1 0 0 0 0 1 1]
[0 1 0 1 0 1 0]
[0 1 0 0 1 0 1]
[0 0 1 1 0 0 1]
[0 0 1 0 1 1 0]
Returns a pair True, pars if the incidence structure is a \(t\)design, for some \(t\), where pars is the list of parameters \((t, v, k, lmbda)\). The largest possible \(t\) is returned, provided \(t=10\).
EXAMPLES:
sage: BD = IncidenceStructure(range(7),[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.is_block_design()
(True, [2, 7, 3, 1])
sage: BD.block_design_checker(2, 7, 3, 1)
True
sage: BD = designs.WittDesign(9) # optional  gap_packages (design package)
sage: BD.is_block_design() # optional  gap_packages (design package)
(True, [2, 9, 3, 1])
sage: BD = designs.WittDesign(12) # optional  gap_packages (design package)
sage: BD.is_block_design() # optional  gap_packages (design package)
(True, [5, 12, 6, 1])
sage: BD = designs.AffineGeometryDesign(3, 1, GF(2))
sage: BD.is_block_design()
(True, [2, 8, 2, 1])
Returns \((t,v,k,lambda)\). Does not check if the input is a block design.
INPUT:
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]], name="FanoPlane")
sage: BD.parameters(t=2)
(2, 7, 3, 1)
sage: BD.parameters(t=3)
(3, 7, 3, 0)
Returns the list of points.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.points()
[0, 1, 2, 3, 4, 5, 6]
Literally pushes this block design over to GAP and returns the points of that. Other than debugging, usefulness is unclear.
REQUIRES: GAP’s Design package.
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.points_from_gap() # optional  gap_packages (design package)
doctest:1: DeprecationWarning: Unless somebody protests this method will be removed, as nobody seems to know why it is there.
See http://trac.sagemath.org/14499 for details.
[1, 2, 3, 4, 5, 6, 7]
Builds and incidence structure from a matrix.
INPUT:
EXAMPLES:
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD1 = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: M = BD1.incidence_matrix()
sage: BD2 = IncidenceStructureFromMatrix(M)
sage: BD1 == BD2
True
Returns the coordinatewise product of a list of vectors.
INPUT:
EXAMPLES:
sage: from sage.combinat.designs.incidence_structures import coordinatewise_product
sage: L = [[1,2,3],[1,1,1],[5,7,11]]
sage: coordinatewise_product(L)
[5, 14, 33]