Skip to content

Instantly share code, notes, and snippets.

View nitaku's full-sized avatar

Matteo Abrate nitaku

  • IIT CNR
  • Pisa, Italy
View GitHub Profile
@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
SVG text bounding box

An example that uses the SVG DOM function getBBox() to highlight a text element.

@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Jigsaw treemap (Gosper)

A jigsaw treemap that uses a Gosper space-filling curve layout to represent the flare software package hierarchy. Use the mouse to zoom and pan.

Only the first level of the tree is displayed, to avoid cluttering the map. Label placement is naively performed by placing text at the region's centroid, so the results are far from ideal. Labels are scaled according to the region area.

@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Jigsaw treemap (Hilbert)
@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Hilbert treemap (area encoding)

This example combines a Hilbert jigsaw treemap with an area encoding: Each cell (a class of the flare software package) is scaled accordingly to its size property. This is different from the standard approach of treemaps, that either uses the leaves' size to affect the whole map, or chooses not to display size information at all (all leaves have a unit area).

@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Gosper treemap (area encoding)
@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Gosper treemap with hierarchical edge bundling

A Gosper treemap of the flare software package hierarchy. Imports, that define links between software classes, are represented using Danny Holten's hierarchical edge bundling (see Holten et al. - 2006).

The tension of the bundling is set to a very high value, to try to give bundles a river-like appearance. Other bundling methods are likely to provide better results at that, like skeleton-based ones (Ersoy et al. 2011).

@nitaku
nitaku / README.md
Last active August 29, 2015 13:55
Hilbert treemap (orthogonal projection of depth)

bu

@nitaku
nitaku / READMEn.md
Last active August 29, 2015 13:56
Kanji similarity hierarchical clustering
@nitaku
nitaku / README.md
Last active August 29, 2015 13:56
Untangle a tangled tree

This example uses python graph-tool to convert a tangled tree into a regular tree. A tangled tree is a tree with some nodes with multiple parents, or, more precisely, a Directed Acyclic Graph with a node identified as root, in which not too many nodes have multiple parents.

Starting from this example tangled tree rooted in the node A:

Tangled tree

Two different methods are presented: a simple algorithm yielding one of the shortest tree covering all nodes, and a more complex one that returns one of the longest. In both cases, for each node, its distance from the root is computed. The difference is that the shortest tree algorithm uses the shortest distance (by invoking the corresponding function in graph-tool), while the ot