# Adjacency and Degree

The adjacency and degree functionalities that apply to simple graphs (see [Adjacency and Degree](../Graphs/adjacency-degree.md#graph-sec-adj)) similarly apply to multigraphs.

## Adjacency and Degree Functions for Multigraphs

### `Degree(u): GrphVert -> RngIntElt`

Given a vertex $u$ of a graph $G$, return the degree of $u$, ie the number of edges incident to $u$.

### `Alldeg(G, n): GrphMultUnd, RngIntElt -> { GrphVert}`

Given a multigraph $G$, and a non-negative integer $n$, return the set of all vertices of $G$ that have degree equal to $n$.

### `MaximumDegree(G): GrphMultUnd -> RngIntElt, GrphVert`

### `Maxdeg(G): GrphMultUnd -> RngIntElt, GrphVert`

The maximum of the degrees of the vertices of the multigraph $G$. This function returns two values: the maximum degree, and a vertex of $G$ having that degree.

### `MinimumDegree(G): GrphMultUnd -> RngIntElt, GrphVert`

### `Mindeg(G): GrphMultUnd -> RngIntElt, GrphVert`

The minimum of the degrees of the vertices of the multigraph $G$. This function returns two values: the minimum degree, and a vertex of $G$ having that degree.

### `DegreeSequence(G): GrphMultUnd -> [ { GrphVert} ]`

Given a multigraph $G$ such that the maximum degree of any vertex of $G$ is $r$, return a sequence $D$ of length $r+1$, such that $D[i]$, $1 \leq i \leq r+1$, is the number of vertices in $G$ having degree $i-1$.

### `Neighbours(u): GrphVert -> { GrphVert}`

### `Neighbors(u): GrphVert -> { GrphVert}`

Given a vertex $u$ of a graph $G$, return the set of vertices of $G$ that are adjacent to $u$.

### `IncidentEdges(u): GrphVert -> { GrphEdge}`

Given a vertex $u$ of a graph $G$, return the set of all edges incident with the vertex $u$.

## Adjacency and Degree Functions for Multidigraphs

### `InDegree(u): GrphVert -> RngIntElt`

The number of edges directed into the vertex $u$ belonging to a multidigraph.

### `OutDegree(u): GrphVert -> RngIntElt`

The number of edges of the form $[u, v]$ where $u$ is a vertex belonging to a multidigraph.

### `MaximumInDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Maxindeg(G): GrphMultDir -> RngIntElt, GrphVert`

The maximum indegree of the vertices of the multidigraph $G$. This function returns two values: the maximum indegree, and the first vertex of $G$ having that degree.

### `MinimumInDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Minindeg(G)): GrphMultDir -> RngIntElt, GrphVert`

The minimum indegree of the vertices of the multidigraph $G$. This function returns two values: the minimum indegree, and the first vertex of $G$ having that degree.

### `MaximumOutDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Maxoutdeg(G): GrphMultDir -> RngIntElt, GrphVert`

The maximum outdegree of the vertices of the multidigraph $G$. This function returns two values: the maximum outdegree, and the first vertex of $G$ having that degree.

### `MinimumOutDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Minoutdeg(G): GrphMultDir -> RngIntElt, GrphVert`

The minimum outdegree of the vertices of the multidigraph $G$. This function returns two values: the minimum outdegree, and the first vertex of $G$ having that degree.

### `Degree(u): GrphVert -> RngIntElt`

Given a vertex $u$ belonging to the multidigraph $G$, return the total degree of $u$, i.e. the sum of the in–degree and out–degree for $u$.

### `MaximumDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Maxdeg(G): GrphMultDir -> RngIntElt, GrphVert`

The maximum total degree of the vertices of the multidigraph $G$. This function returns two values: the maximum total degree, and the first vertex of $G$ having that degree.

### `MinimumDegree(G): GrphMultDir -> RngIntElt, GrphVert`

### `Mindeg(G): GrphMultDir -> RngIntElt, GrphVert`

The minimum total degree of the vertices of the multidigraph $G$. This function returns two values: the minimum total degree, and the first vertex of $G$ having that degree.

### `Alldeg(G, n): GrphMultDir, RngIntElt -> { GrphVert}`

Given a multidigraph $G$, and a non–negative integer $n$, return the set of all vertices of $G$ that have total degree equal to $n$.

### `DegreeSequence(G): GrphMultDir -> [ { GrphVert } ]`

Given a multidigraph $G$ such that the maximum degree of any vertex of $G$ is $r$, return a sequence $D$ of length $r + 1$, such that $D[i]$, $1 \leq i \leq r + 1$, is the number of vertices in $G$ having degree $i - 1$.

### `InNeighbours(u): GrphVert -> { GrphVert}`

### `InNeighbors(u): GrphVert -> { GrphVert}`

Given a vertex $u$ of a multidigraph $G$, return the set containing all vertices $v$ such that $[v, u]$ is an edge in $G$, i.e. the initial vertex of all edges that are directed into the vertex $u$.

### `OutNeighbours(u): GrphVert -> { GrphVert}`

### `OutNeighbors(u): GrphVert -> { GrphVert}`

Given a vertex $u$ of the multidigraph $G$, return the set of vertices $v$ of $G$ such that $[u,v]$ is an edge in $G$, i.e. the set of vertices $v$ that are terminal vertices of edges directed from $u$ to $v$.

### `IncidentEdges(u): GrphVert -> { GrphEdge}`

Given a vertex $u$ of a graph $G$, return the set of all edges incident with the vertex $u$, that is, the set of all edges incident into $u$ and incident from $u$.
