Question: graph classes: how to combine multiple graphs into a single graph
gravatar for Daniela Beißer
6.3 years ago by
Daniela Beißer20 wrote:
Hi Paul! One easy method to combine two graphs is implemented in KEGGgraphs. If you don't want to combine them by hand, try the mergeGraphs method: library(graph) library(KEGGgraph) # create 2 random graphs V <- letters[1:10] M <- 1:4 g1 <- randomGraph(V, M, 0.2) g2 <- randomGraph(V, M, 0.2) # merge graphs g3 <- mergeGraphs(list(g1, g2), edgemode="undirected") Regards, Daniela -- M.Sc. Daniela Bei?er Department of Bioinformatics University of Wuerzburg Am Hubland 97074 Wuerzburg Germany Phone: +49 (0)931 31-88051 eMail: daniela.beisser at Message: 12 Date: Thu, 17 Feb 2011 14:59:22 +1100 From: Moshe Olshansky <olshansky at=""""> To: Paul Shannon <pshannon at=""""> Cc: bioc <bioconductor at=""""> Subject: Re: [BioC] graph classes: how to combine multiple graphs into a single graph Message- ID: <cf502f43416bcbfecb283db41e639a08.squirrel at=""""> Content-Type: text/plain; charset="iso-8859-1" Hi Paul, If I understand you correctly, one possibility would be to take a union of the nodes of the two (or several) graphs, start with an empty adjacency matrix (or list of edges) and then add all the edges appearing in all the graphs. Then you should be able to build a graph from that adjacency matrix (or a list of nodes and a list of edges). Regards, Moshe. > > help (package='graph') describes many methods, but none of those > > mentioned seem to combine two graphs into a third -- perhaps even > > combining attributes along the way. > > > > graph::union looked promising, but is defined such that it only works if > > the nodes in each graph are identical. > > > > Any suggestions? Perhaps objects of the new multigraph class can be > > constructed from multiple graphs? > > > > Thanks - > > > > - Paul > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor at > > > > Search the archives: > >
ADD COMMENTlink written 6.3 years ago by Daniela Beißer20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 260 users visited in the last hour