Kitware / clique

Graph editor library/application
Apache License 2.0
10 stars 6 forks source link

"Collapse node" operation should be slightly more sophisticated #95

Open waxlamp opened 9 years ago

waxlamp commented 9 years ago

When collapsing a node, currently this means "hide all neighbors of the node that have degree 1" i.e., all neighbors that connect only to the target node. This has two problems:

  1. Two nodes may have multiple links between them. This would prevent such a node from disappearing on collapse.
  2. Neighboring nodes that connect to each other should not be prevented from being hidden. That is, supposing A has three neighbors {B, C, D}; B connects only to A; C and D connect to A and each other. Since C and D don't associate with anything farther away from A, they should both disappear on collapse.

The solution is to investigate who the neighbors of A's neighbors are, rather than examining their degree.

jeffbaumes commented 9 years ago

Fixing the first issue seems straightforward and I think we should fix that. The second is a bit more nuanced and I wonder whether we should support it. Suppose you have the triangle graph A,B,C. You expand C get its link to D, then expand D, which links to all other nodes. I feel that collapsing D should not be left with just D, but supporting issue 2 would do just that.

I propose that collapse a node A means "hide nodes that only connect to A".

waxlamp commented 9 years ago

I'm ok with this definition. I'll be sure to just resolve (1) above.