[jgrapht-users] Moving a subgraph?
Brought to you by:
barak_naveh,
perfecthash
From: <org...@io...> - 2016-07-01 17:41:56
|
Hello. I have a DAG that represents a rose tree (I've overridden the various add() methods to enforce the invariant that a vertex may have at most one incoming edge): https://en.wikipedia.org/wiki/Rose_tree I would like to be able to move an arbitrary "branch" of the tree from one graph to another (both rose trees, with the same invariants). That is, I want to remove the branch from one graph and add it as a successor of one of the nodes in another graph. Is there a reliable and "atomic" way to do this in jgrapht? By atomic, I mean that either the operation completely succeeds, or it's as if it never took place and both of the graphs remain untouched. I believe that I need to somehow get access to the subgraph of nodes that are successors (direct or indirect) of the "root" vertex of the branch that I want to move. Unfortunately, I'm a little overwhelmed by the size of the API and am not sure which one (if any) of the existing jgrapht classes I need to use to achieve this. Any help would be appreciated! M |