  
  [1X4 [33X[0;0YTopological data analysis[133X[101X
  
  
  [1X4.1 [33X[0;0YPersistent homology[133X[101X
  
  [33X[0;0YPairwise  distances  between  [22X74[122X  points  from  some  metric space have been
  recorded  and  stored  in a [22X74× 74[122X matrix [22XD[122X. The following commands load the
  matrix,  construct a filtration of length [22X100[122X on the first two dimensions of
  the  assotiated clique complex (also known as the [13XRips Complex[113X), and display
  the  resulting  degree [22X0[122X persistent homology as a barcode. A single bar with
  label [22Xn[122X denotes [22Xn[122X bars with common starting point and common end point.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xfile:=HapFile("data253a.txt");;[127X[104X
    [4X[25Xgap>[125X [27XRead(file);[127X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XG:=SymmetricMatrixToFilteredGraph(D,100);[127X[104X
    [4X[28XFiltered graph on 74 vertices.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XK:=FilteredRegularCWComplex(CliqueComplex(G,2));[127X[104X
    [4X[28XFiltered regular CW-complex of dimension 2[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XP:=PersistentBettiNumbers(K,0);;[127X[104X
    [4X[25Xgap>[125X [27XBarCodeCompactDisplay(P);[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  next  commands  display the resulting degree [22X1[122X persistent homology as a
  barcode.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP:=PersistentBettiNumbers(K,1);;[127X[104X
    [4X[25Xgap>[125X [27XBarCodeCompactDisplay(P);[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  following  command  displays  the  [22X1[122X skeleton of the simplicial complex
  arizing as the [22X65[122X-th term in the filtration on the clique complex.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XY:=FiltrationTerm(K,65);[127X[104X
    [4X[28XRegular CW-complex of dimension 1[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XDisplay(HomotopyGraph(Y));[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThese  computations  suuggest  that the dataset contains two persistent path
  components  (or  clusters),  and  that  each path component is in some sense
  periodic. The final command displays one possible representation of the data
  as points on two circles.[133X
  
  
  [1X4.1-1 [33X[0;0YBackground to the data[133X[101X
  
  [33X[0;0YEach  point  in the dataset was an image consisting of [22X732× 761[122X pixels. This
  point  was  regarded  as  a  vector  in  [22XR^732×  761[122X  and  the  matrix [22XD[122X was
  constructed using the Euclidean metric. The images were the following:[133X
  
  
  [1X4.2 [33X[0;0YMapper clustering[133X[101X
  
  [33X[0;0YThe  following  example  reads in a set [22XS[122X of vectors of rational numbers. It
  uses  the  Euclidean  distance  [22Xd(u,v)[122X between vectors. It fixes some vector
  $u_0\in S$ and uses the associated function [22Xf: D→ [0,b] ⊂ R, v↦ d(u_0,v)[122X. In
  addition,  it  uses  an  open  cover of the interval [22X[0,b][122X consisting of [22X100[122X
  uniformly  distributed overlapping open subintervals of radius [22Xr=29[122X. It also
  uses a simple clustering algorithm implemented in the function [10Xcluster[110X.[133X
  
  [33X[0;0YThese  ingredients are input into the Mapper clustering procedure to produce
  a simplicial complex [22XM[122X which is intended to be a representation of the data.
  The  complex [22XM[122X is [22X1[122X-dimensional and the final command uses GraphViz software
  to  visualize  the graph. The nodes of this simplicial complex are "buckets"
  containing  data  points.  A  data  point may reside in several buckets. The
  number  of  points  in the bucket determines the size of the node. Two nodes
  are  connected  by  an  edge  when their end-point nodes contain common data
  points.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xfile:=HapFile("data134.txt");;[127X[104X
    [4X[25Xgap>[125X [27XRead(file);[127X[104X
    [4X[25Xgap>[125X [27Xdx:=EuclideanApproximatedMetric;;[127X[104X
    [4X[25Xgap>[125X [27Xdz:=EuclideanApproximatedMetric;;[127X[104X
    [4X[25Xgap>[125X [27XL:=List(S,x->Maximum(List(S,y->dx(x,y))));;[127X[104X
    [4X[25Xgap>[125X [27Xn:=Position(L,Minimum(L));;[127X[104X
    [4X[25Xgap>[125X [27Xf:=function(x); return [dx(S[n],x)]; end;;[127X[104X
    [4X[25Xgap>[125X [27XP:=30*[0..100];; P:=List(P, i->[i]);;[127X[104X
    [4X[25Xgap>[125X [27Xr:=29;;[127X[104X
    [4X[25Xgap>[125X [27Xepsilon:=75;;[127X[104X
    [4X[25Xgap>[125X [27X cluster:=function(S)[127X[104X
    [4X[25X>[125X [27X  local Y, P, C;[127X[104X
    [4X[25X>[125X [27X  if Length(S)=0 then return S; fi;[127X[104X
    [4X[25X>[125X [27X  Y:=VectorsToOneSkeleton(S,epsilon,dx);[127X[104X
    [4X[25X>[125X [27X  P:=PiZero(Y);[127X[104X
    [4X[25X>[125X [27X  C:=Classify([1..Length(S)],P[2]);[127X[104X
    [4X[25X>[125X [27X  return List(C,x->S{x});[127X[104X
    [4X[25X>[125X [27X end;;[127X[104X
    [4X[25Xgap>[125X [27XM:=Mapper(S,dx,f,dz,P,r,cluster);[127X[104X
    [4X[28XSimplicial complex of dimension 1.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GraphOfSimplicialComplex(M));[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X4.2-1 [33X[0;0YBackground to the data[133X[101X
  
  [33X[0;0YThe  datacloud  [22XS[122X  consists  of  the  [22X400[122X  points  in the plane shown in the
  following picture.[133X
  
  
  [1X4.3 [33X[0;0YDigital image analysis[133X[101X
  
  [33X[0;0YThe  following  example  reads in a digital image as a filtered pure cubical
  complexex.  The  filtration  is  obtained  by  thresholding at a sequence of
  uniformly  spaced  values on the greyscale range. The persistent homology of
  this  filtered complex is calculated in degrees [22X0[122X and [22X1[122X and displayed as two
  barcodes.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xfile:=HapFile("image1.3.2.png");;[127X[104X
    [4X[25Xgap>[125X [27XF:=ReadImageAsFilteredPureCubicalComplex(file,20);[127X[104X
    [4X[28XFiltered pure cubical complex of dimension 2.[128X[104X
    [4X[25Xgap>[125X [27XP:=PersistentBettiNumbers(F,0);;[127X[104X
    [4X[25Xgap>[125X [27XBarCodeCompactDisplay(P);[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XP:=PersistentBettiNumbers(F,1);;[127X[104X
    [4X[25Xgap>[125X [27XBarCodeCompactDisplay(P);[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe [22X20[122X persistent bars in the degree [22X0[122X barcode suggest that the image has [22X20[122X
  objects.  The  degree  [22X1[122X  barcode suggests that [22X14[122X (or possibly [22X17[122X) of these
  objects have holes in them.[133X
  
  
  [1X4.3-1 [33X[0;0YBackground to the data[133X[101X
  
  [33X[0;0YThe following image was used in the example.[133X
  
