---
title: "Incidence Structures, Graphs, and Codes"
canonical: "https://docs.magma-maths.org/v2.30-1/Combinatorics/Designs/graph-code.html"
source: "https://docs.magma-maths.org/v2.30-1/Combinatorics/Designs/graph-code.md"
part: "Combinatorics"
chapter: "Incidence Structures and Designs"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Combinatorics", "source": "https://docs.magma-maths.org/v2.30-1/Combinatorics/index-combinatorics.md"}
  - {"title": "Incidence Structures and Designs", "source": "https://docs.magma-maths.org/v2.30-1/Combinatorics/Designs/index-designs.md"}
prev: {"title": "The Automorphism Group of an Incidence Structure", "source": "https://docs.magma-maths.org/v2.30-1/Combinatorics/Designs/automorphism-group.md"}
next: {"title": "Automorphisms of Matrices", "source": "https://docs.magma-maths.org/v2.30-1/Combinatorics/Designs/matrix-aut.md"}
intrinsics:
  - {"name": "IncidenceStructure", "signature": "IncidenceStructure(G): Grph -> Inc"}
  - {"name": "PointGraph", "signature": "PointGraph(D): Inc -> Grph"}
  - {"name": "BlockGraph", "signature": "BlockGraph(D): Inc -> Grph"}
  - {"name": "IncidenceGraph", "signature": "IncidenceGraph(D): Inc -> Grph"}
  - {"name": "LinearCode", "signature": "LinearCode(D, K): Inc, FldFin -> Code"}
examples:
  - "ex-09b77a"
---

# Incidence Structures, Graphs, and Codes

<a id="function-incidencestructure-grph"></a>
## `IncidenceStructure(G): Grph -> Inc`

Construct the incidence structure $D$ corresponding to the graph $G$, where the blocks of $D$ correspond to the edges of $G$.

<a id="function-pointgraph-inc"></a>
## `PointGraph(D): Inc -> Grph`

The point graph $G$ of the incidence structure $D$. The graph $G$ has the same point set as $D$ and two vertices $u$ and $v$ of $G$ are adjacent whenever there is a block of $D$ containing both $u$ and $v$.

<a id="function-blockgraph-inc"></a>
## `BlockGraph(D): Inc -> Grph`

The block graph of the incidence structure $D$, i.e., the point graph of the dual of $D$.

<a id="function-incidencegraph-inc"></a>
## `IncidenceGraph(D): Inc -> Grph`

The incidence graph of the incidence structure $D$. This bipartite graph has as vertex set the union of the point set $P$ and block set $B$ of $D$. A vertex $p \in P$ is adjacent to a vertex $b \in B$ whenever $p \in b$.

<a id="function-linearcode-inc-fldfin"></a>
## `LinearCode(D, K): Inc, FldFin -> Code`

Given an incidence structure $D$ with $v$ points and a finite field $K$, this function returns the linear code $C$ of length $v$ generated by the characteristic functions of the blocks of $D$ considered as vectors of the $K$-space $K^{(v)}$.

<a id="example-ex-09b77a"></a>
## `Example: Code of the Witt Design (ex-09b77a)`

The linear code of the Witt 5-(24, 8, 1) design over GF(2) is the extended Golay code over GF(2).

```magma
> D := WittDesign(24);
> C := LinearCode(D, GF(2));
> C eq GolayCode(GF(2), true);
true
```
