Graphics Reference
In-Depth Information
Chapter 8
Lightweight Programming
Sometimes you need to go beyond what has been prepackaged even in the
most flexible point-and-click software. In graph analysis, programming
typically becomes useful in a few areas. This chapter provides some code
examples for both Python and JavaScript. Each section starts with a simple
introductory example and then builds progressively to more detailed
examples.
Often data isn't quite right and must be cleaned or transformed into a graph.
Python is an excellent programming tool for programming novices (and even
experts) to quickly create some code to manipulate graph data. Examples in
the first part of the chapter include cleaning data—extracting nodes from a
data set with only links, and extracting both nodes and links from a data set
not organized as a graph (for example, e-mail).
AlthoughGephiandCytoscapemayseempowerful,sometimes youmaywant
to use other types of visualizations, or perhaps you want to put an interactive
graph on a web page. JavaScript is one way to build out lightweight
visualizations. The second part of the chapter focuses on JavaScript, the
drawing format Scalable Vector Graphics (SVG), and the visualization library
D3. The discussion builds incrementally from simple geometry, through
simple graphs with rectangular and circular layouts, to interactive
force-directed graphs.
Python
If you've ever done any programming, Python is quick to learn, has a
straightforward syntax, and is fairly forgiving. Python provides
object-oriented programming concepts, but if you want, you can do
everything procedurally. If you are comfortable using Excel, Python is not a
big jump.
Note
Note that Python had some changes between version 2 and version 3. All
the examples shown here utilize Python version 3 or later.
Search WWH ::




Custom Search