GRAPH/JSON - json serialization of graphs


 

Abstract

The GRAPH/JSON library provides functions for serializing graph objects as defined by the GRAPH library to/from JSON.

The code is available under the GNU General Public License.

Source: http://github.com/eschulte/graph.
 

Contents

  1. Source
  2. Introduction
  3. The GRAPH/JSON dictionary
    1. from-d3
    2. from-json
    3. to-d3
    4. to-html
    5. to-json
  4. Acknowledgements

 

Source

GRAPH/JSON together with this documentation can be found at http://github.com/eschulte/graph.
 

Introduction

Helper function for serializing Graphs to JSON objects and reading JSON objects back into graphs. The JSON syntax for a graph is compatible with the JavaScript d3 visualization library, allowing for interactive viewing of graphs in the browser.

See d3 (specifically d3-force) for more.


 

The GRAPH/JSON dictionary


[Generic function]
from-d3 graph input => result


Parse a D3 format string or stream INPUT into GRAPH.


[Generic function]
from-json graph input => result



[Method]
from-json (graph graph) input => result


Parse string or stream INPUT into GRAPH.


[Generic function]
to-d3 graph &key stream group-fn => result


Return a JSON encoding of GRAPH formatted for D3. Edges should have numeric values which d3 will translate into their width. Optional keyword argument GROUP-FN should be a function from nodes to group numbers.


[Generic function]
to-html graph &key stream group-fn => result


Write GRAPH to an HTML file. The resulting HTML file will display an interactive version of GRAPH. Uses to-d3 to first encode the graph as JSON which is embedded in the HTML page.


[Generic function]
to-json graph &key stream node-fn edge-fn => result


Write a JSON encoding of GRAPH to STREAM.

 

Acknowledgements

This documentation was prepared with a hacked up version of DOCUMENTATION-TEMPLATE.