# Graph manifold

For a given graph $G(V,E)$ implemented using `LightGraphs.jl`

, the `GraphManifold`

models a `PowerManifold`

either on the nodes or edges of the graph, depending on the `GraphManifoldType`

. i.e., it's either a $\mathcal M^{\lvert V \rvert}$ for the case of a vertex manifold or a $\mathcal M^{\lvert E \rvert}$ for the case of a edge manifold.

## Example

To make a graph manifold over $ℝ^2$ with three vertices and two edges, one can use

```
using Manifolds
using LightGraphs
M = Euclidean(2)
p = [[1., 4.], [2., 5.], [3., 6.]]
q = [[4., 5.], [6., 7.], [8., 9.]]
x = [[6., 5.], [4., 3.], [2., 8.]]
G = SimpleGraph(3)
add_edge!(G, 1, 2)
add_edge!(G, 2, 3)
N = GraphManifold(G, M, VertexManifold())
```

GraphManifold Graph: {3, 2} undirected simple Int64 graph Manifold on vertices: Euclidean(2; field = ℝ)

It supports all `AbstractPowerManifold`

operations (it is based on `NestedPowerRepresentation`

) and furthermore it is possible to compute a graph logarithm:

`incident_log(N, p)`

3-element Array{Array{Float64,1},1}: [1.0, 1.0] [0.0, 0.0] [-1.0, -1.0]

## Types and functions

`Manifolds.EdgeManifold`

— Type`EdgeManifoldManifold <: GraphManifoldType`

A type for a `GraphManifold`

where the data is given on the edges.

`Manifolds.GraphManifold`

— Type`GraphManifold{G,𝔽,M,T} <: AbstractPowerManifold{𝔽,M,NestedPowerRepresentation}`

Build a manifold, that is a `PowerManifold`

of the `Manifold`

`M`

either on the edges or vertices of a graph `G`

depending on the `GraphManifoldType`

`T`

.

**Fields**

`G`

is an`AbstractSimpleGraph`

`M`

is a`Manifold`

`Manifolds.GraphManifoldType`

— Type`GraphManifoldType`

This type represents the type of data on the graph that the `GraphManifold`

represents.

`Manifolds.VertexManifold`

— Type`VectexGraphManifold <: GraphManifoldType`

A type for a `GraphManifold`

where the data is given on the vertices.

`Manifolds.incident_log`

— Method`incident_log(M::GraphManifold, x)`

Return the tangent vector on the (vertex) `GraphManifold`

, where at each node the sum of the `log`

s to incident nodes is computed. For a `SimpleGraph`

, an egde is interpreted as double edge in the corresponding SimpleDiGraph

If the internal graph is a `SimpleWeightedGraph`

the weighted sum of the tangent vectors is computed.

`ManifoldsBase.check_manifold_point`

— Method`check_manifold_point(M::GraphManifold, p)`

Check whether `p`

is a valid point on the `GraphManifold`

, i.e. its length equals the number of vertices (for `VertexManifold`

s) or the number of edges (for `EdgeManifold`

s) and that each element of `p`

passes the `check_manifold_point`

test for the base manifold `M.manifold`

.

`ManifoldsBase.check_tangent_vector`

— Method`check_tangent_vector(M::GraphManifold, p, X; check_base_point = true, kwargs...)`

Check whether `p`

is a valid point on the `GraphManifold`

, and `X`

it from its tangent space, i.e. its length equals the number of vertices (for `VertexManifold`

s) or the number of edges (for `EdgeManifold`

s) and that each element of `X`

together with its corresponding entry of `p`

passes the `check_tangent_vector`

test for the base manifold `M.manifold`

. The optional parameter `check_base_point`

indicates, whether to call `check_manifold_point`

for `p`

.

`ManifoldsBase.manifold_dimension`

— Method`manifold_dimension(N::GraphManifold{G,𝔽,M,EdgeManifold})`

returns the manifold dimension of the `GraphManifold`

`N`

on the edges of a graph $G=(V,E)$, i.e.

\[\dim(\mathcal N) = \lvert E \rvert \dim(\mathcal M),\]

where $\mathcal M$ is the manifold of the data on the edges.

`ManifoldsBase.manifold_dimension`

— Method`manifold_dimension(N::GraphManifold{G,𝔽,M,VertexManifold})`

returns the manifold dimension of the `GraphManifold`

`N`

on the vertices of a graph $G=(V,E)$, i.e.

\[\dim(\mathcal N) = \lvert V \rvert \dim(\mathcal M),\]

where $\mathcal M$ is the manifold of the data on the nodes.