Hi Rajesh,There is no clean method to merge two graphs (or more),but you can try this way :|| Graph a, b, c;|| a = new DefaultGraph("a");| b = new DefaultGraph("b");| c = new DefaultGraph("c");|| c.setStrict(false);|| a.addSink(c);| b.addSink(c);|| a.addNode("A");| a.addNode("B");| a.addNode("C");|| a.addEdge("AB", "A", "B");| a.addEdge("AC", "A", "C");| a.addEdge("BC", "B", "C");|| b.addNode("A");| b.addNode("D");| b.addNode("E");|| b.addEdge("AD", "A", "D");| b.addEdge("AE", "A", "E");| b.addEdge("DE", "D", "E");|This merges graph a and b into graph c. Do not forgetthe setStrict(false) on c to prevent exception whenadding an already existing node.If your graphs are already created, you can use GraphReplay :|| GraphReplay replay = new GraphReplay("replay");| replay.addSink(c);|| replay.replay(a);| replay.replay(b);|Regards.Guilhelm--2012/6/29 Rajesh Veeranki <rveeranki01 AT gmail.com>
Oh.. thanks a lot.That helped me.I also want to know if there is a method to merge two graphs ( i.e, the edges of the same node in the two graphs are merged )Thanks,Rajesh V
On Fri, Jun 29, 2012 at 4:18 AM, Stefan Balev <stefan.balev AT gmail.com> wrote:Hi Rajesh,The easiest way to check if a node exists looks like that :Graph g = ...;...if (g.getNode("foo") != null) {// the node exists} else {// the node does not exist}Hope it helps,--Stefan
2012/6/29 <rveeranki01 AT gmail.com>:
> Hi,
> I want to know if there is any easy method to see if a node(with the unique id)
> is already created.I have seen the documentation but couldn't find any.
> Thanks in advance,
> Rajesh V
Guilhelm Savin
PhD Student of Computer ScienceLITIS, University of Le Havre
\/\/\/\/\/\/
Archives gérées par MHonArc 2.6.16.