#1 Topological output and minor changes


Hi Michel,

Pretty useful project you have here, I haven't read the
clustering algorithms yet but have used it (with
ecological similarity indexes among samples!).
Hierarchical clustering makes that a LOT more useful,
so thank you very much :)

This patch adds a topological output to
Cluster(.topology()) and a respective method to
BaseClusterMethod(.topo()). It also changes .data()
behavior to avoid the .data()[0] idiom.

Feeding the output of .topo() to
gives (e.g.):

9 -----+
8 -----+ |
# --+ |
|--+ |
w --+ | |
e -----+

Regarding the .data() change:
* I think it'd be better to keep two different
datasets (.raw and .data?), because both states (flat
and clustered) are pretty different beasts.
* Perhaps having .data() "contents" stored as
.data would make things easier (in a "why call a method
with no parameters, that returns an object" way :)).
Making .data a property would keep current behavior and
require less ()s :)

I'm working on an advanced version of the topological
view and on a derivative of that printing recipe for my
own needs, but will forward them here when done.

Thanks again,


  • ajaksu

    ajaksu - 2006-08-05

    Topology patch for cluster.py

  • ajaksu

    ajaksu - 2006-08-08

    Logged In: YES

    Duh, of course SF mangles the ASCII art.
    Here's something I'm getting from very ugly, very poor code.
    It's based on the recipe above, plus handling of tags
    (levels) and a hack that lets Cluster.topology() know that I
    want a label instead of each item's repr.

  • ajaksu

    ajaksu - 2006-08-08

    ASCII art for clusters.

  • Michel Albert

    Michel Albert - 2006-08-16

    Logged In: YES

    Hi Daniel,

    thanks for the input. It gives me the warm and fuzzy
    feeling, that this project is indeed still in use ;)

    Having topological output for the clusters is a brilliant
    idea. I remember well, a couple of weeks ago. I was sitting
    at the desk with several A4 pages taped together, and was
    drawing the output of python-cluster for debugging. Hehe...

    Having this is very useful. I had a quick look through your
    code, and it looks fine. I will merge it as soon as I get
    the time.

    Thanks a lot,


  • Michel Albert

    Michel Albert - 2006-08-19
    • status: open --> closed-fixed
  • Michel Albert

    Michel Albert - 2006-08-19
    • status: closed-fixed --> open-accepted
  • Michel Albert

    Michel Albert - 2006-08-19

    Logged In: YES

    Bah, I accidentally updated an old revision with this
    patch. Need to re-do the work :(

  • Michel Albert

    Michel Albert - 2006-08-19
    • status: open-accepted --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks