[BioC] graph classes: how to combine multiple graphs into a single graph

Daniela Beißer daniela.beisser at biozentrum.uni-wuerzburg.de
Fri Feb 18 10:22:41 CET 2011


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 biozentrum.uni-wuerzburg.de 

Message: 12 Date: Thu, 17 Feb 2011 14:59:22 +1100 From: Moshe Olshansky 
<olshansky at wehi.EDU.AU> To: Paul Shannon <pshannon at systemsbiology.org> 
Cc: bioc <bioconductor at stat.math.ethz.ch> Subject: Re: [BioC] graph 
classes: how to combine multiple graphs into a single graph Message-ID: 
<cf502f43416bcbfecb283db41e639a08.squirrel at wehimail.alpha.wehi.edu.au> 
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 r-project.org
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
> > Search the archives:
> > http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list