---
title: "Planes, Graphs, and Codes"
canonical: "https://docs.magma-maths.org/v2.30-1/Geometry/FinitePlanes/graph-code.html"
source: "https://docs.magma-maths.org/v2.30-1/Geometry/FinitePlanes/graph-code.md"
part: "Geometry"
chapter: "Finite Planes"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Geometry", "source": "https://docs.magma-maths.org/v2.30-1/Geometry/index-geometry.md"}
  - {"title": "Finite Planes", "source": "https://docs.magma-maths.org/v2.30-1/Geometry/FinitePlanes/index-finite-planes.md"}
prev: {"title": "Planes and Designs", "source": "https://docs.magma-maths.org/v2.30-1/Geometry/FinitePlanes/designs.md"}
next: {"title": "Incidence Geometry", "source": "https://docs.magma-maths.org/v2.30-1/Geometry/IncidenceGeometry/index-incidence-geometry.md"}
intrinsics:
  - {"name": "LineGraph", "signature": "LineGraph(P): Plane -> Grph"}
  - {"name": "IncidenceGraph", "signature": "IncidenceGraph(P): Plane -> Grph"}
  - {"name": "LinearCode", "signature": "LinearCode(P, K): Plane, FldFin -> Code"}
examples:
  - "ex-43be98"
---

# Planes, Graphs, and Codes

Magma provides the following functions to create the graphs and codes naturally associated to a projective or affine plane.

<a id="function-linegraph-plane"></a>
## `LineGraph(P): Plane -> Grph`

The line graph of the plane $P$.

<a id="function-incidencegraph-plane"></a>
## `IncidenceGraph(P): Plane -> Grph`

The incidence graph of the plane $P$. This bipartite graph has as vertex set the union of the point set $V$ and line set $L$ of $P$. A vertex $p \in V$ is adjacent to a vertex $l \in L$ whenever $p \in l$.

<a id="function-linearcode-plane-fldfin"></a>
## `LinearCode(P, K): Plane, FldFin -> Code`

Given a plane $P$ 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 lines of $P$ considered as vectors of the $K$-space $K^{(v)}$.

<a id="example-ex-43be98"></a>
## `Example: Incidence Graph and Code of a Plane (ex-43be98)`

```magma
> P, V, L := FiniteAffinePlane(3);
> #V, #L;
9 12
> IncidenceGraph(P);
Graph
Vertex  Neighbours

1       10 11 12 19 ;
2       16 17 18 19 ;
3       13 14 15 19 ;
4       10 15 17 21 ;
5       12 14 16 21 ;
6       11 13 18 21 ;
7       10 14 18 20 ;
8       11 15 16 20 ;
9       12 13 17 20 ;
10      1 4 7 ;
11      1 6 8 ;
12      1 5 9 ;
13      3 6 9 ;
14      3 5 7 ;
15      3 4 8 ;
16      2 5 8 ;
17      2 4 9 ;
18      2 6 7 ;
19      1 2 3 ;
20      7 8 9 ;
21      4 5 6 ;

> LinearCode(P, Field(P));
[9, 6, 3] Linear Code over GF(3)
Generator matrix:
[1 0 0 0 0 1 0 1 0]
[0 1 0 0 0 1 0 2 2]
[0 0 1 0 0 1 0 0 1]
[0 0 0 1 0 2 0 1 2]
[0 0 0 0 1 2 0 2 1]
[0 0 0 0 0 0 1 1 1]
```
