## The following example demonstrates how to use the program racg_algorithms.py¶

In :
import racg_algorithms as r


We create three graphs. The "square" graph is a 4-cycle. The "pentagon_amalg_square" graph is a 5-cycle glued to a 4-cycle along one vertex. While, "G" corresponds to a thick RACG.

In :
square = r.Graph(4)
square.set_edges([(0,2),(0,3),(1,2),(1,3)])

pentagon_amalg_square = r.Graph(8)
pentagon_amalg_square.set_edges([(0,1),(1,2),(2,3),(3,4),(4,0),(0,5),(0,6),(6,7),(5,7)])

G = r.Graph(9)
G.set_edges([(0,2),(0,3),(0,8),(0,4),(1,2),(1,3),(1,8),(1,4),(2,5),(3,5),(4,6),(4,7),(5,6),(5,7),(6,7)])


Edges of a graph object are encoded by an adjacency list.

In :
G.edges

Out:
[[2, 3, 8, 4],
[2, 3, 8, 4],
[0, 1, 5],
[0, 1, 5],
[0, 1, 6, 7],
[2, 3, 6, 7],
[4, 5, 7],
[4, 5, 6],
[0, 1]]

The group_summary function summarizes what can be computed regarding the divergence, thickness and hypergraph index of the RACG associated to a graph.

In :
r.group_summary(square)

Out:
'Divergence is linear. Thick of order 0. Hypergraph index is 0'
In :
r.group_summary(pentagon_amalg_square)

Out:
'The graph is relatively hyperbolic and the hypergraph index is infinite.'
In :
r.group_summary(G)

Out:
'Divergence is a polynomial of degree 3. Thick of order 2. Hypergraph index is 2.'

We get further information on the group's divergence by finding the rank n pairs. get_rank_n_pairsreturns a list of lists, ranked_n_pairs. The pairs of vertices in ranked_pairs[i] are the rank i pairs. ranked_pairs is the set of all pairs of non-adjacent vertices

In :
rank_n_pairs = r.get_rank_n_pairs(G)
len(rank_n_pairs)

Out:
3

From below, we know that the bi-infinite geodesic, ...060606... in the RACG corresponding to G has at least cubic divergence (actually by above we know the divergence is exactly cubic).

In :
rank_n_pairs

Out:
[(0, 6),
(0, 7),
(1, 6),
(1, 7),
(2, 6),
(2, 7),
(3, 6),
(3, 7),
(6, 8),
(7, 8)]

We may also just compute the hypergraph index:

In :
r.get_hyp_index(G)

Out:
2