Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: dvs79Well, I continue to talk to myself I thought better of how to realize the generic clusterization algorithm (frequent task in data mining).
Maybe it'll be useful for somebody.
So:
I
have 2 tables:
a) list of items (with unic IDs);
b) "matrix of connectivity", consisting of 2 fields "id1" and "id2", where each record represents a pair of connected items (i.e. items, belonging to the same cluster).
The
task is to assign a cluster_ID (CL_ID) to every item, so that connected items (from matrix of connectivity) would have common CL_ID.
To do so, I do as follows:
1. Execute BRX Node consecutively takes each pair of IDs from the connectivity matrix and give them to the main graph (brx).
2. In the main graph the iterative algorithm is realized:
2.1 There's generated a list of items with field "CL_ID" added (initially it's filled with "0"s). This field is being filled consecutively with each iteration.
2.2 Each pair of IDs is checked against this table and there're 4 possible situations:
a) The both items has already CL_ID values assigned and these CL_IDs are equal.
Do nothing.
b) The both items has already CL_ID values assigned and these CL_IDs are different.
Then the greater CL_ID is "absorbed" by the smaller (or vice versa, doesn't matter), i.e. two clusters are merged
c) One item has already CL_ID, but the other hasn't.
Assign to the latter the CL_ID of the former.
d) The both items have no CL_ID.
Assign them both the new CL_ID, greater by 1 than the current maximum CL_ID.
The main flaw of this solution - it's sooo slow I'd be happy to get advice how to optimize it.
The graphs are in attachment.
Attachments:
clusterization_brx.zip