# Connect Subtree on a Tree LightGraphs

**URL:** <https://discourse.julialang.org/t/connect-subtree-on-a-tree-lightgraphs/57875>\
**Category:** General Usage\
**Tags:** package, optimization\
**Created:** [March 24, 2021, 3:38pm UTC](https://discourse.julialang.org/t/connect-subtree-on-a-tree-lightgraphs/57875 "2021-03-24T15:38:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![afazevedo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afazevedo/32/16394_2.png) [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Post date:** [March 24, 2021, 3:38pm UTC](https://discourse.julialang.org/t/connect-subtree-on-a-tree-lightgraphs/57875/1 "2021-03-24T15:38:29Z")

</div>

Good afternoon everybody.

In my work, i need to disconnect subtrees from my graph and connect elsewhere. My question is whether in the LightGraphs package, or in another package, is there an easy way to do this?

In the LighGraphs package, there is the “add\_edge!” and “remove\_edge!” macro. I’m doubting if existis “add\_subtree!” or “remove\_subtree!”, or something like that.

Anyway, even though there are no such specific macros, I am looking for an easier way to do this operation.

Best Regards!

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [March 24, 2021, 5:29pm UTC](https://discourse.julialang.org/t/connect-subtree-on-a-tree-lightgraphs/57875/2 "2021-03-24T17:29:10Z")

</div>

Might this be related to your question?

> [@Combine two graphs in lightgraph](https://discourse.julialang.org/t/combine-two-graphs-in-lightgraph/53462):
>
> Hi, I have two graphs that represent SQL tables : f = star\_graph(5) nodelabel = ["T1","C1","C2","C3","C4"] h = star\_graph(4) nodelabel = ["T2","C1.2","C2.2","C3.2"] I want to context both graphs on “C2” and “C3.2” how do I do that in lightgraph?
