# EmbeddedGraphs.jl

Documentation for EmbeddedGraphs.jl

A simple package that provides support for embedded graphs.

`EmbeddedGraphs.EmbeddedGraph`

— MethodConstructor functions for the EmbeddedGraph structure

`EmbeddedGraphs.EuclideanGraph`

— TypeEuclideanGraph{T<:Integer} <: AbstractEmbeddedGraph{T}

Euclidean Graph

`EmbeddedGraphs.EuclideanGraph`

— MethodConstructor functions for the EuclideanGraph structure

`Base.getindex`

— MethodExtends Base.getindex function to be able to call EG[i,j]. Returns the distance of the two vertices in the metric of the graph.

`Base.getindex`

— MethodExtends Base.getindex function to be able to call EG[i,j]. Returns the distance of the two vertices in the metric of the graph.

`Base.rand`

— MethodExtends the Base.rand function to work with a SimpleEdgeIter

`EmbeddedGraphs.detour_indices`

— Methoddetour_indices(eg::AbstractEmbeddedGraph, i)

`EmbeddedGraphs.random_geometric!`

— MethodAdds m shortest edges.

`EmbeddedGraphs.random_geometric!`

— MethodAdds all edges shorter than r.

`EmbeddedGraphs.random_geometric_graph!`

— Method`random_geometric_graph!(eg, radius; dist_func=Nothing)`

From an existing embedded complete graph `eg`

, create a random geometric graph by removing edges between vertices that are more than `radius`

apart. This in-place graph generator offers more flexibility with respect to the properties of the resulting EmbeddedGraph instance `eg`

. For instance, the embedding metric determining the values of `weights(eg)`

can be distinct from the distance function `dist_func`

that is used to create the random geometric graph.

Ref.: Penrose, Mathew. Random geometric graphs. Vol. 5. Oxford university press, 2003.

**Optional Arguments**

`dist_func`

: distance function used to construct the random geometric graph. It can differ from the`distance`

attribute of`eg`

to allow for independent edge weights. Defaults to`eg.distance`

when`dist_func=Nothing`

is passed.

**Examples**

```
julia> egh = EmbeddedGraph(complete_graph(n), pos, hamming);
julia> random_geometric_graph!(egh, rad; dist_func=euclidean)
julia> egh.graph
{50, 71} undirected simple Int64 graph
```

`EmbeddedGraphs.random_geometric_graph`

— Method`random_geometric_graph(n, radius; dim=2, pos=Nothing, embedding_metric=Nothing, dist_func=Nothing)`

Create a random geometric graph with `n`

vertices that are connected when their distance is less than `radius`

. The vertex locations are randomly drawn from a uniform distribution on the unit interval in each dimension.

Ref.: Penrose, Mathew. Random geometric graphs. Vol. 5. Oxford university press, 2003.

**Optional Arguments**

`dim`

: embedding dimension. Defaults to dim=2.`pos`

: vertex positions can be given as a list of`n`

points with`dim`

coordinates. Defaults to pos=Nothing.`dist_func`

: distance function used to construct the random geometric graph. It can differ from the`distance`

attribute of`eg`

to allow for independent edge weights. Defaults to`eg.distance`

when`dist_func=Nothing`

is passed.

**Examples**

```
julia> random_geometric_graph(50, 0.2).graph
{50, 105} undirected simple Int64 graph
```

`EmbeddedGraphs.vertices_loc`

— MethodFunctions return an array with the value of the vertices in the given spatial direction 1 == x direction, 2 == y direction, 3 == z direction ...

`EmbeddedGraphs.wiring_length`

— MethodCalculate the sum of all the weights of the edges of a graph.

`Graphs.SimpleGraphs.add_vertex!`

— MethodAdds vertex in the given graph. Position in the form [x,y,z,...] needed.

`Graphs.SimpleGraphs.rem_vertex!`

— Method```
Extends Graphs.jl function and deletes also the element in the
EG.vertexpos array. rem_vertex! in Graphs.jl swaps the vertex v with
the last vertex and then uses pop! on the list to delete the last element.
```

`Graphs.SimpleGraphs.rem_vertices!`

— MethodRemoves multiple vertices with given Indices at once

`Graphs.add_vertices!`

— MethodAdds multiple vertices in the given graph at once. Position Array is needed.

`Graphs.edges`

— MethodExtends basic Graphs.jl functions to work with AbstractEmbeddedGraphs

`Graphs.weights`

— Method```
Weights function gives back the weightmatrix of the graph.
It can be choosen whether the matrix should be dense, i.e. the distance
between every vertex is inserted, or sparse, i.e. only the distance
between connected vertices is given back.
```

## Index

`EmbeddedGraphs.EmbeddedGraph`

`EmbeddedGraphs.EuclideanGraph`

`EmbeddedGraphs.EuclideanGraph`

`Base.getindex`

`Base.getindex`

`Base.rand`

`EmbeddedGraphs.detour_indices`

`EmbeddedGraphs.random_geometric!`

`EmbeddedGraphs.random_geometric!`

`EmbeddedGraphs.random_geometric_graph`

`EmbeddedGraphs.random_geometric_graph!`

`EmbeddedGraphs.vertices_loc`

`EmbeddedGraphs.wiring_length`

`Graphs.SimpleGraphs.add_vertex!`

`Graphs.SimpleGraphs.rem_vertex!`

`Graphs.SimpleGraphs.rem_vertices!`

`Graphs.add_vertices!`

`Graphs.edges`

`Graphs.weights`