Scroll to navigation

gv(3python) gv(3python)

NAME

gv_python - graph manipulation in python

SYNOPSIS

#!/usr/bin/python
import sys
import gv

USAGE

INTRODUCTION

gv_python is a dynamically loaded extension for python that provides access to the graph facilities of graphviz.

COMMANDS



graph_handle gv.graph (name);
graph_handle gv.digraph (name);
graph_handle gv.strictgraph (name);
graph_handle gv.strictdigraph (name);

graph_handle gv.readstring (string);
graph_handle gv.read (string filename);
graph_handle gv.read (channel);

graph_handle gv.graph (graph_handle, name);


node_handle gv.node (graph_handle, name);


edge_handle gv.edge (tail_node_handle, head_node_handle);

edge_handle gv.edge (tail_node_handle, head_name);

edge_handle gv.edge (tail_name, head_node_handle);

edge_handle gv.edge (graph_handle, tail_name, head_name);


string gv.setv (graph_handle, attr_name, attr_value);
string gv.setv (node_handle, attr_name, attr_value);
string gv.setv (edge_handle, attr_name, attr_value);

string gv.setv (graph_handle, attr_handle, attr_value);
string gv.setv (node_handle, attr_handle, attr_value);
string gv.setv (edge_handle, attr_handle, attr_value);


string gv.getv (graph_handle, attr_name);
string gv.getv (node_handle, attr_name);
string gv.getv (edge_handle, attr_name);

string gv.getv (graph_handle, attr_handle);
string gv.getv (node_handle, attr_handle);
string gv.getv (edge_handle, attr_handle);

string gv.nameof (graph_handle);
string gv.nameof (node_handle);
string gv.nameof (attr_handle);

graph_handle gv.findsubg (graph_handle, name);
node_handle gv.findnode (graph_handle, name);
edge_handle gv.findedge (tail_node_handle, head_node_handle);
attribute_handle gv.findattr (graph_handle, name);
attribute_handle gv.findattr (node_handle, name);
attribute_handle gv.findattr (edge_handle, name);

node_handle gv.headof (edge_handle);
node_handle gv.tailof (edge_handle);
graph_handle gv.graphof (graph_handle);
graph_handle gv.graphof (edge_handle);
graph_handle gv.graphof (node_handle);
graph_handle gv.rootof (graph_handle);

node_handle gv.protonode (graph_handle);
edge_handle gv.protoedge (graph_handle);


bool gv.ok (graph_handle);
bool gv.ok (node_handle);
bool gv.ok (edge_handle);
bool gv.ok (attr_handle);

graph_handle gv.firstsubg (graph_handle);
graph_handle gv.nextsubg (graph_handle, subgraph_handle);

graph_handle gv.firstsupg (graph_handle);
graph_handle gv.nextsupg (graph_handle, subgraph_handle);

edge_handle gv.firstedge (graph_handle);
edge_handle gv.nextedge (graph_handle, edge_handle);

edge_handle gv.firstout (graph_handle);
edge_handle gv.nextout (graph_handle, edge_handle);

edge_handle gv.firstedge (node_handle);
edge_handle gv.nextedge (node_handle, edge_handle);

edge_handle gv.firstout (node_handle);
edge_handle gv.nextout (node_handle, edge_handle);

node_handle gv.firsthead (node_handle);
node_handle gv.nexthead (node_handle, head_node_handle);

edge_handle gv.firstin (graph_handle);
edge_handle gv.nextin (node_handle, edge_handle);

edge_handle gv.firstin (node_handle);
edge_handle gv.nextin (graph_handle, edge_handle);

node_handle gv.firsttail (node_handle);
node_handle gv.nexttail (node_handle, tail_node_handle);

node_handle gv.firstnode (graph_handle);
node_handle gv.nextnode (graph_handle, node_handle);

node_handle gv.firstnode (edge_handle);
node_handle gv.nextnode (edge_handle, node_handle);

attribute_handle gv.firstattr (graph_handle);
attribute_handle gv.nextattr (graph_handle, attr_handle);

attribute_handle gv.firstattr (edge_handle);
attribute_handle gv.nextattr (edge_handle, attr_handle);

attribute_handle gv.firstattr (node_handle);
attribute_handle gv.nextattr (node_handle, attr_handle);

bool gv.rm (graph_handle);
bool gv.rm (node_handle);
bool gv.rm (edge_handle);


bool gv.layout (graph_handle, string engine);


bool gv.render (graph_handle);

bool gv.render (graph_handle, string format);

bool gv.render (graph_handle, string format, channel fout);

bool gv.render (graph_handle, string format, string filename);

bool gv.renderchannel (graph_handle, string format, string channelname);

gv.renderresult (graph_handle, string format, string outdata);

(deprecated - too easy to leak memory)

(still needed for "eval [gv::renderdata $G tk]" )

string gv.renderdata (graph_handle, string format);

bool gv.write (graph_handle, string filename);
bool gv.write (graph_handle, channel);

KEYWORDS

graph, dot, neato, fdp, circo, twopi, python.

10 December 2009