Hi, I am a new R user. I have seen the use of kmeans in clustering.
However, I would like to ask how I can add more constraints to the kmeans.
For example, I have a set of data for a 10 nodes network,

price = c(84, 96, 57, 53, 90, 94, 81, 66, 93, 54)

I want to use K mean to to group this set of data into two group. However,
nodes in the same group should be in the same group. they are connected as
below.

 mymatrix <- rbind(
+      c(1,1,2,3,3,3,2,1,1,1),
+      c(1,1,1,2,2,2,1,1,1,1),
+      c(2,1,1,1,1,1,1,1,2,2),
+      c(3,2,1,1,1,1,1,2,3,3),
+      c(3,2,1,1,1,1,1,2,3,3),
+      c(3,2,1,1,1,1,1,2,2,2),
+      c(2,1,1,1,1,1,1,1,2,2),
+      c(1,1,1,2,2,2,1,1,1,1),
+      c(1,1,2,3,3,2,2,1,1,1),
+      c(1,1,2,3,3,2,2,1,1,1))

How can I do it in R. I greatly appreciate your help. I wish a happy
Easter.

Hanna

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to