/gvpr-lib

Rod's little library for augmenting and extending gvpr, the graph processing tool bundled with Graphviz.

Primary LanguageJavaScriptOtherNOASSERTION

Rod's gvpr Extensions

This repository contains resources that augment or extend gvpr, Graphviz's graph pattern recognizer.

gvpr is an awk-like language for modifying or processing graphs (expressed in the DOT language).

gvpr was written by Emden Gansner and is part of Graphviz, an open source graph visualization and manipulation library created at AT&T Labs Research.

What's gvpr again?

gvpr can process one or more DOT files, applying user-specified actions for every element for that meets the conditions of the corresponding (and also user-specified) predicates.

For example, the gvpr script:

N [color=="red"] { shape = "oval" }

will change the shape of every red node to oval. To use this script, we can issue a command like:

gvpr -c "N [color==\"red\"] { shape = \"oval\" }" mygraph.gv

which will apply the given transformation to the graph defined in the file mygraph.gv (and print the resulting graph to stdout). For more, you can download a PDF rendition of the gvpr man page or check the documentation that was bundled with your Graphviz install.

Ok, what's in this repository then?

  1. gvpr-mode.el, a simple emacs mode for editing gvpr scripts. gvpr-mode is also available on the Marmalade repository. Run M-x package-install gvpr-mode to install it (once Marmalade has been set up as described here.)

  2. common.gvpr - A small library of utility functions for use with gvpr. (A suite of automated tests for these functions can be found in the test directory, and run using the top-level Makefile by invoking make test.)

  3. gvprss - a pre-processor that implements a CSS-like stylesheet language on top of gvpr. gvprss is implemented in JavaScript/Node.js and is published as an npm module. You can install it by running npm install -g gvprss.

So what are these for?

Well, gvpr-mode is just a quick-and-dirty syntax coloring mode I threw together because I was working on a number of gvpr scripts and wanted to make it easier on myself.

The gvprss and the common set of gvpr functions are an outcome of and related to a book I've been writing called The Graphviz Cookbook. If you're working with gvpr or Graphviz, please check that out (and tell your friends :) ).

A note on licensing.

gvpr-mode.el, like emacs itself, is released under the GNU General Public License as described within the file.

Everything else is released under an MIT License, as described in license.txt.