The University of Queensland Homepage
School of ITEE ITEE Main Website

 Hierarchical cluster analysis

Hierarchical cluster analysis

A long time ago I wrote a simple program that allows you to generate cluster dendrograms from text files. If you have some use for it, help yourself...

Three files are needed:

  1. hfig2_1.c
  2. figformat.c
  3. figformat.h

Compile:

> gcc hfig2_1.c figformat.c -lm

or use the precompiled version (for SUN OS 5.8): hfig2_1

Use:

The program takes as input (on the standard input) text on the following form:

<textlabel> <value> <value> <value> ... <value>

<textlabel> <value> <value> <value> ... <value>

<textlabel> <value> <value> <value> ... <value>

...

and generates a file on the FIG format. Use xfig on your Unix system to edit and export it to other formats.

The program has a number of settings which can be changed.

Usage: hfig2_1 [-ealp] [-f string] [-s int] [-r float] [-w int] [-d int]
    -e use euclidean distance (default)
    -c use city-block distance
    -a use vector angle
    -l use vector length
    -m use merge method -m1 DISTxy=min(DISTx,DISTy) (default) -m2 DISTxy=(DISTx+DISTy)/2
    -p produce debug-info
    -f write to specified file (default "noname.fig")
    -s specify fontsize (default 12)
    -r specify scale of axis (default 0.5)
    -w specify width of produced figure (default 600, min 220)
    -d specify y-distance between printed items (default 20)

Example:

You have a file abc.dat with labels and values

Bob  0.23 0.45 1.66

Jane 2.3 0.08 1.1

John 0.88 0.01 1.0

Jim  2.1 0.55 1.7

You generate the diagram:

> hfig2_1 -f mydiagram.fig < abc.dat

You start xfig and edit the file:

> xfig mydiagram.fig

and export it to a convenient graphics format (e.g. Encapsulated Postscript or GIF):