# reindexBy -- reindexes the vertices according to the input ordering.

## Synopsis

• Usage:
G' = reindexBy(G, ordering)
D' = reindexBy(D, ordering)
• Inputs:
• G, an instance of the type Graph,
• D, an instance of the type Digraph,
• ordering, ,
• Outputs:
• G', an instance of the type Graph,
• D', an instance of the type Digraph, the graph or digraph with vertices reindexed according to the String ordering

## Description

This method reindexes the vertices of a specified graph or digraph according to the ordering method entered by the user. The orderings available for graphs are: "maxdegree" (orders the vertices in order of highest to lowest degree), "mindegree" (orders the vertices in order of lowest to highest degree), "random" (orders the vertices randomly), "components" (orders the vertices in the same connected components close together in indices), and "sort" (orders the vertices by sorting their names). For digraphs, the orderings available are: "maxdegreein" (orders the vertices in order of highest in-degree to lowest in-degree), "mindegreein" (orders the vertices in order of lowest in-degree to highest in-degree), "maxdegreeout" (orders the vertices in order of highest out-degree to lowest out-degree), "mindegreeout" (orders the vertices in order of lowest out-degree to highest out-degree), "maxdegree" (orders the vertices in order of highest to lowest degree in the underlying undirected graph), "mindegree" (orders the vertices in order of lowest to highest degree in the underlying undirected graph), "random" (orders the vertices randomly), "sort" (orders the vertices by sorting their names).

 i1 : G = graph({1,2,3,4,5},{{1,3},{3,4},{4,5}}); i2 : reindexBy(G,"maxdegree") o2 = Graph{1 => {3} } 2 => {} 3 => {4, 1} 4 => {3, 5} 5 => {4} o2 : Graph i3 : D = digraph({1,2,3,4,5},{{1,2},{2,3},{3,1},{4,5},{5,4}}) o3 = Digraph{1 => {2}} 2 => {3} 3 => {1} 4 => {5} 5 => {4} o3 : Digraph i4 : reindexBy(D, "mindegreeout") o4 = Digraph{1 => {2}} 2 => {3} 3 => {1} 4 => {5} 5 => {4} o4 : Digraph