EmbeddedGraphs.jl

Documentation for EmbeddedGraphs.jl

A simple package that provides support for embedded graphs.

Base.getindexMethod

Extends 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.getindexMethod

Extends 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.randMethod

Extends the Base.rand function to work with a SimpleEdgeIter

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_graphMethod
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_locMethod

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

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.add_vertices!Method

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

Graphs.edgesMethod

Extends basic Graphs.jl functions to work with AbstractEmbeddedGraphs

Graphs.weightsMethod
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