Hi All,

I am looking for an algorithm/program that separates all of the data chunk i,e how many chunks are there. Moreover, that program will also be giving information of the size of the chunks and which are the elements. I am explained my problem by this following example

suppose I have three chunk of data points and one isolated point. each chunk of data are related by some rule.

chunk1: 1,2,8,9,11,12; connectivity: 1-2, 2-12,2-11,8-9,8-11
chunk2: 4,7,10; connectivity: 4-7,7-10,4-10
chunk3: 5,6; connectivity 5-6
chunk4: 3

Therefore, the total no of data points in this system are 12 and the dimension of connectivity matrix will be 12X12. I have set 1 if the two elements are connected in this matrix and the rest of the elements are 0. Moreover, the diagonal elements of this matrix was st to 0 because connection within the same element is meaningless. Therefore, the matrix, h(i,j), looks like

0 1 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0 1 0
0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 1 0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 1 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0

Now, my question is, how do I find the the number of chunks and which elements constitute those chunks for a given matrix.

I have thought by this way:
1. go along first row, if there is any 1 then find out that column (j) and set that element and its conjugate as 0 i,e h(i,j)=h(j,i)=0 as that matrix is always symmetric. the element i is the first element of the first cluster.
2. In the next step go to the jth row and repeat the same procedure.
3. when there is no 1 along the row then the first cluster has been sorted out. repeat the same thing for 2nd ..3rd ...nth cluster until the all elements of that matrix is 0
4) when all elements of that matrix is 0 then computation is finished. The rest of the elements will be isolated elements.

However, I am facing difficulty to implement this algorithm using fortran. This is because if a row contains more than one 1 (i,e a element is connected simultaniously with more than one element) then how do I go to those rows simulataniously.

Can anyone help me in this regard? any logic or any idea or any program will be helpful for me.

Thanks in advance
Sudipta

Some context would be helpful, to know what your purpose is and what you mean by a "data chunk".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.