# How to export the edges information?

**URL:** <https://forum.graphviz.org/t/how-to-export-the-edges-information/1529>\
**Category:** Help\
**Created:** [March 22, 2023, 4:12pm UTC](https://forum.graphviz.org/t/how-to-export-the-edges-information/1529 "2023-03-22T16:12:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tulio](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@tulio](https://forum.graphviz.org/u/tulio)\
**Post date:** [March 22, 2023, 4:12pm UTC](https://forum.graphviz.org/t/how-to-export-the-edges-information/1529/1 "2023-03-22T16:12:21Z")

</div>

Hey,

I was doing some analysis of bacterial images, and searching for the best way to plot a tree with the mother cells and the daughter cells and found the graphviz. I got the plot I wanted following the example, but I had some problems:

I would like to extract the information used in this plot, the connections between the cells, I tried and I couldn’t and I didn’t find how to do it. Looking at stackoverflow it is suggested to use a ‘cliptree’ file that does exactly what I want, lists with each hierarchy found ([https://stackoverflow.com/questions/63404997/how-to-get-edges-as-list-from-graphviz-file](https://stackoverflow.com/questions/63404997/how-to-get-edges-as-list-from-graphviz-file)). I didn’t find this file in my installation and I couldn’t use the other suggestions.

Another point, is there any way to prune the plot? I have a very big dataset and the plot is getting unfeasible, I would like to plot only the nodes with a certain len. I attached the plot from my data  
[unix.gv.pdf](https://forum.graphviz.org/uploads/short-url/mVk0w4ImG4ovVzMgoJQR4JenD4k.pdf) (248.6 KB).

I know it may sound simple, but I would really appreciate the support.

Thanks,

Tulio

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [March 22, 2023, 5:53pm UTC](https://forum.graphviz.org/t/how-to-export-the-edges-information/1529/2 "2023-03-22T17:53:30Z")

</div>

Here is a copy of the cliptree code. I did not write it, I’m just the messenger.  
Based on a very quick read, my solution on stackoverflow looks pretty inefficient. I’ll think about improving it.

```auto
/* Construct subgraph reachable from node ARGV[0] by forward edges */
BEG_G {
  node_t r = node($,ARGV[0]);
  $tvroot = r;
  $tvtype = TV_fwd;
}
N{
  $tvroot=NULL; 
  subnode($T,$);
}

```

There are ways to cut-up graphs like yours, but I think you misspoke about “nodes with a certain length” (nodes don’t have length). Might you mean:

- trees with a nodes minimum (or maximum) number of nodes?
- trees with a minimum (or maximum) number of ranks (width in this case) ?
- other?

---

<div class="post-metadata">

**Author:** ![tulio](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@tulio](https://forum.graphviz.org/u/tulio)\
**Post date:** [March 24, 2023, 9:04am UTC](https://forum.graphviz.org/t/how-to-export-the-edges-information/1529/3 "2023-03-24T09:04:15Z")

</div>

Thank you. I’ll try this code.

Yes you are right, nodes don’t have length, but since this info are stored into a list or dict they have length. Sorry about this misunderstanding.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [March 24, 2023, 4:22pm UTC](https://forum.graphviz.org/t/how-to-export-the-edges-information/1529/4 "2023-03-24T16:22:17Z")

</div>

You might also look at the Graphviz program ccomps ([https://graphviz.org/pdf/ccomps.1.pdf](https://graphviz.org/pdf/ccomps.1.pdf)).  
It may be just what you are looking for.
