While attempting to write out an algorithm to find all triangles (a->b->c->a) from an adjacency matrix, I stumbled across functionality in the igraph library for R that makes this process trivial to implement for any pattern. triangles.Rraw downloadlibrary(igraph) #create an arbitrary graph adjacency.graph <- erdos.renyi.game(100,0.1,directed=TRUE) #create the pattern to match triangle <- graph.ring(3,directed=TRUE) #find all […]