Re: [jgrapht-users] Getting all connected sets of a graph as graphs
Brought to you by:
barak_naveh,
perfecthash
From: Tim J. <ts...@rc...> - 2011-04-26 11:09:53
|
Hi, On Mon, 25 Apr 2011 22:26:13 -0700, John Sichi <js...@gm...> wrote: > Does your ProteinGraph add anything interesting? If not, you might > consider discarding it and just using the out-of-the-box classes > directly. Yes, it adds some functions that are specific for protein graphs, e.g. determining the N-terminus and T-terminus of the protein chain and returning different linear notations for protein graphs. I also plan to add functions that draw the graph and write them to an image file. But I think my current way of implementing the ProteinGraph class is far from perfect. I'll start a new thread for this though. > If you need it for some reason, then either do what you said at the > end to make copies of the subgraphs (using Graphs.addGraph), or else > make ProteinGraph an interface and create subclasses for extending > SimpleGraph and UndirectedSubgraph. Thanks a lot for, I didn't know about Graphs.addGraph() and it does exactly what I wanted. Here's what I do now: List<Set<SSE>> conVertSets = ci.connectedSets(); // Create graphs out of the connected sets for(Integer j = 0; j < conVertSets.size(); j++) { UndirectedSubgraph<SSE, LabeledEdge> sg = new UndirectedSubgraph<SSE, LabeledEdge>(g, conVertSets.get(j), null); ProteinGraph<SSE, LabeledEdge> psg = new ProteinGraph<SSE, LabeledEdge>(new ClassBasedEdgeFactory<SSE, LabeledEdge>(LabeledEdge.class)); Graphs.addGraph(psg, sg); } This works. :) -- Tim |