Function Repository Resource:

# WolframRicciCurvatureScalar

Compute the Wolfram–Ricci scalar curvature of a graph and its associated properties

Contributed by: Jonathan Gorard

## Details and Options

The Wolfram–Ricci scalar curvature is computed by comparing the volume of a finite geodesic ball in the graph to that of a finite geodesic ball of the same radius in a flat manifold (i.e. the discrete analog of the standard Ricci scalar curvature in Riemannian geometry).
Wolfram–Ricci curvature represents one possible definition of discrete Ricci curvature for an arbitrary graph, based upon a discretization of the power series expansion of a continuous Riemannian volume element. This stands in contrast with other such definitions, such as the Ollivier-Ricci curvature, which is based upon measure theory (defined in terms of the Wasserstein distance between geodesic balls after parallel transport), and the Forman-Ricci curvature, which is based upon topology (defined by treating the graph as an abstract CW-complex).
In ResourceFunction["WolframRicciCurvatureScalar"][graph,], graph can be either directed or undirected, in which case the Wolfram–Ricci scalar curvature approximates either the Lorentzian or Riemannian Ricci scalar curvature, respectively.
ResourceFunction["WolframRicciCurvatureScalar"] can compute the Wolfram–Ricci curvature scalar at a given vertex by either taking an average over geodesic balls of all different radii, taking a minimum/maximum over all radii, or otherwise returning every possible result.
When no maximum or minimum radius is specified, ResourceFunction["WolframRicciCurvatureScalar"] automatically uses the graph radius as the maximum radius.
For directed graphs, ResourceFunction["WolframRicciCurvatureScalar"] computes volumes of finite geodesic cones, as opposed to geodesic balls.
In ResourceFunction["WolframRicciCurvatureScalar"][graph,dim,], dim can be any arbitrary real number (i.e. fractional-dimensional spaces are supported).
In ResourceFunction["WolframRicciCurvatureScalar"][,"prop"], the following properties can be requested:
 "Volume" the volumes of geodesic balls of various radii around a given vertex "AllVolumes" an association showing the volumes of geodesic balls of various radii around each vertex "Curvature" the Wolfram–Ricci scalar curvature at a given vertex "AllCurvatures" an association showing the Wolfram–Ricci scalar curvatures at each vertex "HighlightedGraph" a highlighted graph depicting how the Wolfram–Ricci scalar curvature is computed
The default property for ResourceFunction["WolframRicciCurvatureScalar"] is either "Curvature" (if a vertex v is specified) or "AllCurvatures" (if a vertex v is not specified).
Options for ResourceFunction["WolframRicciCurvatureScalar"] include:
 "TransitivelyReduce" whether to use the transitive reduction of the input graph "UndirectedGraph" whether to use the undirected form of the input graph "AverageVolumes" whether to take an average over geodesic balls of different volumes "VolumeMethod" whether to take a maximum, minimum or mean over geodesic balls of different volumes (or simply return all values) "CurvatureMethod" whether to take a maximum, minimum or mean over geodesic balls yielding different curvatures (or simply return all values) "VertexMethod" whether to take a maximum, minimum or mean over all vertices in the input graph (or simply return all values)
The possible values for the options "VolumeMethod", "CurvatureMethod" and "VertexMethod" are Max, Min, Mean and Identity. For each of the options, Identity will return a list of all possible values, while Max, Min and Mean will return a maximum, minimum or mean of the elements of the resulting list, respectively.

## Examples

### Basic Examples (4)

Compute the Wolfram–Ricci scalar curvature at vertex 150 in a 20-by-20 2-dimensional grid graph:

 In[1]:=
 Out[1]=

Compute the maximum and minimum curvatures over geodesic balls with radii up to 8:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=

Return a list of all curvatures over geodesic balls with radii up to 8:

 In[4]:=
 Out[4]=

Show the geodesic balls with radii up to 8 as a highlighted graph:

 In[5]:=
 Out[5]=

Return an Association showing the Wolfram–Ricci scalar curvatures at each vertex:

 In[6]:=
 Out[6]=

Compute the maximum and minimum curvatures across all vertices:

 In[7]:=
 Out[7]=
 In[8]:=
 Out[8]=

Compute the average curvature across all vertices:

 In[9]:=
 Out[9]=

Compute the average volume of geodesic balls around vertex 250 in a 10-by-10-by-10 3-dimensional grid graph:

 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

Compute the maximum and minimum volumes of geodesic balls with radii between 3 and 9:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

Return a list of all volumes of geodesic balls with radii between 3 and 9:

 In[14]:=
 Out[14]=

Show the geodesic balls with radii between 3 and 9 as a highlighted graph:

 In[15]:=
 Out[15]=

Return an Association showing the geodesic ball volumes around each vertex:

 In[16]:=
 Out[16]=

Compute the maximum and minimum ball volumes across all vertices:

 In[17]:=
 Out[17]=
 In[18]:=
 Out[18]=

Compute the average ball volume across all vertices:

 In[19]:=
 Out[19]=

Compute the Wolfram–Ricci scalar curvature at an arbitrary vertex in an approximately spherical graph (produced using ExtrinsicCurvedManifoldToGraph), and show that the curvature is positive:

 In[20]:=
 In[21]:=
 Out[21]=

Show the geodesic balls with radii up to 6 as a highlighted graph:

 In[22]:=
 Out[22]=

Compute the Wolfram–Ricci scalar curvature at an arbitrary vertex in an approximately hyperbolic paraboloidal graph (produced using ExtrinsicCurvedManifoldToGraph), and show that the curvature is negative:

 In[23]:=
 In[24]:=
 Out[24]=

Show the geodesic balls with radii up to 3 as a highlighted graph:

 In[25]:=
 Out[25]=

### Scope (4)

If given a graph and a number of dimensions, WolframRicciCurvatureScalar returns an Association showing the Wolfram–Ricci scalar curvatures at each vertex, using the graph radius as the maximum geodesic ball radius:

 In[26]:=
 Out[26]=
 In[27]:=
 Out[27]=

 In[28]:=
 Out[28]=

If given a graph, a number of dimensions, a vertex and a maximum radius, WolframRicciCurvatureScalar returns the Wolfram–Ricci scalar curvature at that vertex:

 In[29]:=
 Out[29]=

#### Directed versus undirected graphs (3)

WolframRicciCurvatureScalar also supports directed graphs:

 In[30]:=
 In[31]:=
 Out[31]=

In the directed case, the Wolfram–Ricci scalar curvature is computed using volumes of geodesic cones, as opposed to geodesic balls:

 In[32]:=
 Out[32]=

However, WolframRicciCurvatureScalar can be made to treat directed graphs as though they were undirected (and hence revert to using geodesic balls) with the option "UndirectedGraph":

 In[33]:=
 Out[33]=
 In[34]:=
 Out[34]=

#### Fractional dimensional graphs (1)

WolframRicciCurvatureScalar also supports curvature computations in graphs with non-integer dimensionality, such as this Sierpinski sieve graph:

 In[35]:=
 Out[35]=
 In[36]:=
 Out[36]=
 In[37]:=
 Out[37]=

### Options (14)

#### CurvatureMethod (3)

Compute the average Wolfram–Ricci scalar curvature over geodesic balls around vertex 150 with radii between 3 and 9 in a 20-by-20 2-dimensional grid graph with the option value "CurvatureMethod"Mean (default):

 In[38]:=
 Out[38]=
 In[39]:=
 Out[39]=

Return a list of all curvatures over geodesic balls with radii between 3 and 9 instead:

 In[40]:=
 Out[40]=

Compute the maximum and minimum curvatures over geodesic balls with radii between 3 and 9 with the options "CurvatureMethod"Max and "CurvatureMethod"Min, respectively:

 In[41]:=
 Out[41]=
 In[42]:=
 Out[42]=

#### TransitivelyReduce (3)

By default, directed graphs are not transitively-reduced:

 In[43]:=

Compute (and visualize) the Wolfram–Ricci curvature scalar, assuming that the graph is not transitively reduced:

 In[44]:=
 Out[44]=
 In[45]:=
 Out[45]=

WolframRicciCurvatureScalar can be made to treat unreduced directed graphs as though they were transitively-reduced with the option "TransitivelyReduce":

 In[46]:=
 Out[46]=
 In[47]:=
 Out[47]=

#### UndirectedGraph (3)

By default, directed graphs are treated as directed (and so curvature computations use the volumes of geodesic cones, as opposed to geodesic balls):

 In[48]:=

Compute (and visualize) the Wolfram–Ricci curvature scalar, assuming that the graph is directed:

 In[49]:=
 Out[49]=
 In[50]:=
 Out[50]=

WolframRicciCurvatureScalar can be made to treat directed graphs as though they were undirected with the option "UndirectedGraph":

 In[51]:=
 Out[51]=
 In[52]:=
 Out[52]=

#### VertexMethod (2)

Return an Association showing the geodesic ball volumes around each vertex in a 20-by-20 2-dimensional grid graph (default):

 In[53]:=
 Out[53]=
 In[54]:=
 Out[54]=

Compute the average ball volume across all vertices with the option "VertexMethod"Mean:

 In[55]:=
 Out[55]=

Compute the maximum and minimum ball volumes across all vertices with the options "VertexMethod"Max and "VertexMethod"Min, respectively:

 In[56]:=
 Out[56]=
 In[57]:=
 Out[57]=

Return an association showing the Wolfram–Ricci scalar curvature at each vertex in a 20-by-20 2-dimensional grid graph (default):

 In[58]:=
 Out[58]=
 In[59]:=
 Out[59]=

Compute the average curvature across all vertices with the option "AverageVertices":

 In[60]:=
 Out[60]=

Compute the maximum and minimum curvatures across all vertices with the options "MaxVertices" and "MinVertices", respectively:

 In[61]:=
 Out[61]=
 In[62]:=
 Out[62]=

#### VolumeMethod (3)

Compute the average volume of geodesic balls around vertex 150 with radii between 3 and 9 in a 20-by-20 2-dimensional grid graph with the option value "VolumeMethod"Mean (default):

 In[63]:=
 Out[63]=
 In[64]:=
 Out[64]=

Return a list of all volumes of geodesic balls with radii between 3 and 9 instead:

 In[65]:=
 Out[65]=

Compute the maximum and minimum volumes of geodesic balls with radii between 3 and 9 with the option values "VolumeMethod"Max and "VolumeMethod"Min, respectively:

 In[66]:=
 Out[66]=
 In[67]:=
 Out[67]=