We provide code for
constructing different networks that describe the state of dense
granular media. This code includes functionality for computing the
persistence diagrams using Perseus. For each network we created a
separate class. The distribution contains this class together with
simple example which computes the persistence of the sample
network.
See the graphical representation of the sample networks.
Installation:
1) Download
Perseus.
2) Download the desired network code:
-
interaction network,
-
position
network,
- digital network (under construction).
3) Copy Perseus to the folder obtained by unpacking the network
code.
4) Go to the folder obtained by unpacking the network code and
compile it by using the included makefile. This produces an
executable file Network.
5) Compute the persistence diagrams of the included sample
network. To run the code type ./Network SampleNetwork.txt
Persistence. It will read the network from the file
SampleNetwork.txt and create files Persistence_0.txt and
Persistence_1.txt. The first file contains generators for the
0-dimension persistence diagram and second for the 1-dimension
persistence diagram.
How to use the executable file Network?
The executable requires two input variables. The first one is a
path to the file containing the network. The second parameter
SAVE_AS is a path to the file inot which the persistence
generators are stored. The code will produce two files
SAVE_AS_0.txt and SAVE_AS_1.txt containing the generators of the
persistence diagrams of the given dimension.
Required format of the input files for different networks:
1) Interaction network
The input file is a text file. The first line is the number of
particles (vertices) N present in the system. Every other
line represents an edge and between two particles and looks as
follows: particle_1_ID particle_2_ID value (separated by spaces).
The first two entries identify the particles connected by the
edge. The entries are integers between 0 and N-1. The variable
value corresponds to the value assigned to the edge.
NOTE
that the file has to end with the value for the last edge and not
with an empty line or an invisible character.
2) Position network
The input file is a text file. The first line is the number of
particles (vertices) N. Followed by N lines describing the
particles. The format of each line is x_position y_position radius
value (separated by spaces). The first two parameters correspond
to (x,y) coordinates of the center of a given particle. They are
followed by the radius and the value assigned to the particle.
NOTE
that the file has to end with the value for the last edge and not
with an empty line or an invisible character.
3) Digital network
The input file is a gray scale image where the intensity of the
pixel corresponds to its value.
Format of the persistence files.
For each dimension there is one persistence file. It is a
text file and each line corresponds to a single generator. The
first entry corresponds to the birth and the second to the death
of the generator. We use the supper level set filtration and thus
the birth coordinate is larger than the death coordinate. If the
death coordinate equals -1 then the generator persist until the
end.
NOTE that the code does not carry out the averaging of the
network described in
Quantifying force
networks in particulate systems . If this is desired then
open the file Example.cpp and change the line
network.Persistence( input_file.c_str(), output_file.c_str() ); to
network.NormalizedPersistence( input_file.c_str(),
output_file.c_str() );