I have created an adjacency matrix but have not been able to figure something out. I need to put zeros on the diagonal of the adjacency matrix. For instance, location (i,i) to equal 0. Please help. Thanks -- View this message in context: http://r.789695.n4.nabble.com/Adjacency-Matrix-help-tp3740946p3740946.html Sent from the R help mailing list archive at Nabble.com.
diag(adjMatrix) <-0 On Aug 13, 2011, at 7:34 AM, collegegurl69 wrote:> I have created an adjacency matrix but have not been able to figure something > out. I need to put zeros on the diagonal of the adjacency matrix. For > instance, location (i,i) to equal 0. Please help. Thanks
Thanks so much for your quick reply. it seems to work. the problem is that it now places actual zeros on the diagonal whereas the rest of the adjacency matrix has dots to represent zeroes. Do you have any ideas on how to change these zeros to dots like in the rest of the adj matrix? Or is it the same thing? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Adjacency-Matrix-help-tp3740946p3740996.html Sent from the R help mailing list archive at Nabble.com.
> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of collegegurl69 > Sent: Saturday, August 13, 2011 1:01 AM > To: r-help at r-project.org > Subject: Re: [R] Adjacency Matrix help > > Thanks so much for your quick reply. it seems to work. the problem is that > it > now places actual zeros on the diagonal whereas the rest of the adjacency > matrix has dots to represent zeroes. Do you have any ideas on how to > change > these zeros to dots like in the rest of the adj matrix? Or is it the same > thing? Thanks. >This is one of the reasons why it is useful/important to provide a reproducible example. When I think of an adjacency matrix, my default mental representation is a numeric matrix which was reinforced by the request for zeros on the diagonal. So, how did you create this matrix? Could you post a self-contained, reproducible example as the posting guide requests? At a minimum, can apply str() to your matrix and post the output? Dan Daniel Nordlund Bothell, WA USA