Fwd: What is the purpose of compEdges and compNodes in biogo.graph/undirected?

7 views
Skip to first unread message

Huan Truong

unread,
Mar 31, 2015, 8:47:53 PM3/31/15
to biogo...@googlegroups.com
Hi all,

I'm trying to extend biogo.graph a bit. I'm confused by the presence
of compEdges and compNodes.

If anyone could provide a brief, high-level detail of what are they for, it'd
be much appreciated.

PS: My mail to biogo-dev was bounced back to me, so I'm posting in
biogo-user here.

Thank you,

--

Huan Truong
grad student / treasurer / muii bioinformatics
www tnhh.net / twitter @huant

Dan Kortschak

unread,
Mar 31, 2015, 9:04:09 PM3/31/15
to Huan Truong, biogo...@googlegroups.com
The graph representation is built around []graph.Node and []graph.Edge
rather than a map[int]graph.Node etc. In the vast majority of cases
(when there is no node or edge deletion) the compEdges and compNodes are
not needed, but when edges or nodes are deleted, the deletion is done by
swap-with-end-and-slice on these slices and removal of the element from
the non-comp slice. This allows fast iteration of the full set of valid
edges or nodes, though they may be out of id order (that information is
retained by the non-comp slices).

What particular things are you wanting to add?

Currently, I am not focussing any effort of graph and it is really only
present because there is another biogo package that depends on it. I'm
not particularly happy with its design and plan to deprecate it at some
stage in the future. Unfortunately there is not another undirected graph
package that I am happy to take its place, though I look forward to
seeing github.com/gonum/graph moving that way (it has directed graphs).

BTW use github.com/biogo/... packages since google code will be closing.

Dan

On Tue, 2015-03-31 at 19:47 -0500, Huan Truong wrote:
> Hi all,
>
> I'm trying to extend biogo.graph a bit. I'm confused by the presence
> of compEdges and compNodes.
>
> If anyone could provide a brief, high-level detail of what are they for, it'd
> be much appreciated.
>
> PS: My mail to biogo-dev was bounced back to me, so I'm posting in
> biogo-user here.

Sorry - I don't recall getting that and I don't see a not about it.

Huan Truong

unread,
Mar 31, 2015, 9:17:33 PM3/31/15
to Dan Kortschak, biogo...@googlegroups.com
Thanks Dan -- for the quick and very useful answer.

I am working on a particularly unpopular feature: I'm working on a
massive graph with nodes being sequences of a particular gene. An edge
between two nodes is established when their respective pairwise
similarity passed a threshold. I would like to see how different is
that network in that configuration compared to a random network. I
particularly want to "shuffle" all the edges so that I could retain
the degree distribution, but the relationships between the nodes are
randomized.

So then I'm trying to implement a shuffle function and I was not
familar with the implementation :)

Dan Kortschak

unread,
Mar 31, 2015, 9:25:10 PM3/31/15
to Huan Truong, biogo...@googlegroups.com
The short answer the that is just work on compEdge, changing the value
of the tail or head as appropriate.

This doesn't sound like fun if you actually want to maintain all the
vertex degrees as they are.

Reply all
Reply to author
Forward
0 new messages