I have database with nodes and edges, I need to plot degree distribution for this data (frequency of occurrences of each degree). I'm new to reading delimited data files and can't figure out how to cut into pieces the file.
The file looks like this:
# list of nodes (# x y z coordinates, irrelevant data)
1 x= 0.0 y= 0.0 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
2 x= -1.0 y= 1.732 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
3 x= -1.0 y= -1.732 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
4 x= 2.0 y= -0.0 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
5 x= -2.0 y= 3.464 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
6 x= -2.0 y= -3.464 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
7 x= 4.0 y= -0.0 z= 0.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
8 x= 0.0 y= 0.0 z= 20.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
9 x= -1.0 y= 1.732 z= 20.0 M = 0.01 MU = 0.1 Ixx = 0.001 Iyy = 0.001 Izz = 0.001
...
# list of edges: (# of edge = [ two connected nodes ] #irrelevant information)
1 nodes = [ 1, 8 ] material = Material1
2 nodes = [ 1, 2 ] material = Material1
3 nodes = [ 1, 3 ] material = Material1
4 nodes = [ 1, 4 ] material = Material1
5 nodes = [ 2, 3 ] material = Material1
6 nodes = [ 2, 4 ] material = Material1
7 nodes = [ 2, 5 ] material = Material1
8 nodes = [ 2, 9 ] material = Material1
9 nodes = [ 3, 4 ] material = Material1
10 nodes = [ 3, 10 ] material = Material1
...
I figured out how to plot the histogram when all degrees were given in one column here, but I can't figure out how should I extract this information from the given data set.
What I need is two arrays - one with all possible degrees and second one is frequencies of corresponding degree.