I have the adjacency matrix of a graph. I'm trying to find all triangles (embeddings of C_3). This doesn't work:
index = function(l) seq(l)[l] pairs = do.call(rbind, lapply(seq(nrow(adj)), function(x) cbind(x, index(adj[x,])))) triangles = do.call(rbind, apply(pairs, 1, function(x) cbind(x, index(adj[x[1],] & adj[x[2],])))) I'm absolutely certain I've gone down the wrong path here. O great R gurus, your guidance would be most welcome. -- Taral <[email protected]> "Please let me know if there's any further trouble I can give you." -- Unknown ______________________________________________ [email protected] mailing list 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.

