---
name: "gv"
section: "3sharp"
platform: "linux"
package: "graphviz"
version: "16.1.0-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gv/3sharp"
---

# gv(3sharp)

graph manipulation in sharp

## NAME

gv\_sharp - graph manipulation in sharp

## SYNOPSIS

## USAGE

## INTRODUCTION

**gv\_sharp** is a dynamically loaded extension for **sharp** that provides access to the graph facilities of **graphviz.**

## COMMANDS

- **New graphs**

  - New empty graph

  *SWIGTYPE\_p\_Agraph\_t* **gv.graph** *(string name);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.digraph** *(string name);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.strictgraph** *(string name);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.strictdigraph** *(string name);*\

- New graph from a dot-syntax string or file

  *SWIGTYPE\_p\_Agraph\_t* **gv.readstring** *(string string);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.read** *(string filename);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.read** *(SWIGTYPE\_p\_FILE f);*\

- Add new subgraph to existing graph

  *SWIGTYPE\_p\_Agraph\_t* **gv.graph** *(SWIGTYPE\_p\_Agraph\_t g, string name);*\

- **New nodes**

  - Add new node to existing graph

  *SWIGTYPE\_p\_Agnode\_t* **gv.node** *(SWIGTYPE\_p\_Agraph\_t g, string name);*\

- **New edges**

  - Add new edge between existing nodes

  *SWIGTYPE\_p\_Agedge\_t* **gv.edge** *(SWIGTYPE\_p\_Agnode\_t t, SWIGTYPE\_p\_Agnode\_t h);*\

- Add a new edge between an existing tail node, and a named head node which will be induced in the graph if it doesn't already exist

  *SWIGTYPE\_p\_Agedge\_t* **gv.edge** *(SWIGTYPE\_p\_Agnode\_t t, string hname);*\

- Add a new edge between an existing head node, and a named tail node which will be induced in the graph if it doesn't already exist

  *SWIGTYPE\_p\_Agedge\_t* **gv.edge** *(string tname, SWIGTYPE\_p\_Agnode\_t h);*\

- Add a new edge between named tail and head nodes which will be induced in the graph if they don't already exist

  *SWIGTYPE\_p\_Agedge\_t* **gv.edge** *(SWIGTYPE\_p\_Agraph\_t g, string tname, string hname);*\

- **Setting attribute values**

  - Set value of named attribute of graph/node/edge - creating attribute if necessary

  *string* **gv.setv** *(SWIGTYPE\_p\_Agraph\_t g, string attr, string val);*\
   *string* **gv.setv** *(SWIGTYPE\_p\_Agnode\_t n, string attr, string val);*\
   *string* **gv.setv** *(SWIGTYPE\_p\_Agedge\_t e, string attr, string val);*\

- Set value of existing attribute of graph/node/edge (using attribute handle)

  *string* **gv.setv** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agsym\_t a, string val);*\
   *string* **gv.setv** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agsym\_t a, string val);*\
   *string* **gv.setv** *(SWIGTYPE\_p\_Agedge\_t e, SWIGTYPE\_p\_Agsym\_t a, string val);*\

- **Getting attribute values**

  - Get value of named attribute of graph/node/edge

  *string* **gv.getv** *(SWIGTYPE\_p\_Agraph\_t g, string attr);*\
   *string* **gv.getv** *(SWIGTYPE\_p\_Agnode\_t n, string attr);*\
   *string* **gv.getv** *(SWIGTYPE\_p\_Agedge\_t e, string attr);*\

- Get value of attribute of graph/node/edge (using attribute handle)

  *string* **gv.getv** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agsym\_t a);*\
   *string* **gv.getv** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agsym\_t a);*\
   *string* **gv.getv** *(SWIGTYPE\_p\_Agedge\_t e, SWIGTYPE\_p\_Agsym\_t a);*\

- **Obtain names from handles**

  *string* **gv.nameof** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *string* **gv.nameof** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *string* **gv.nameof** *(SWIGTYPE\_p\_Agsym\_t a);*\

- **Find handles from names**

  *SWIGTYPE\_p\_Agraph\_t* **gv.findsubg** *(SWIGTYPE\_p\_Agraph\_t g, string name);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.findnode** *(SWIGTYPE\_p\_Agraph\_t g, string name);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.findedge** *(SWIGTYPE\_p\_Agnode\_t t, SWIGTYPE\_p\_Agnode\_t h);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.findattr** *(SWIGTYPE\_p\_Agraph\_t g, string name);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.findattr** *(SWIGTYPE\_p\_Agnode\_t n, string name);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.findattr** *(SWIGTYPE\_p\_Agedge\_t e, string name);*\

- **Misc graph navigators returning handles**

  *SWIGTYPE\_p\_Agnode\_t* **gv.headof** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.tailof** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.graphof** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.graphof** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.graphof** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.rootof** *(SWIGTYPE\_p\_Agraph\_t g);*\

- **Obtain handles of proto node/edge for setting default attribute values**

  *SWIGTYPE\_p\_Agnode\_t* **gv.protonode** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.protoedge** *(SWIGTYPE\_p\_Agraph\_t g);*\

- **Iterators**

  - Iteration termination tests

  *bool* **gv.ok** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *bool* **gv.ok** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *bool* **gv.ok** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *bool* **gv.ok** *(SWIGTYPE\_p\_Agsym\_t a);*\

- Iterate over subgraphs of a graph

  *SWIGTYPE\_p\_Agraph\_t* **gv.firstsubg** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.nextsubg** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agraph\_t sg);*\

- Iterate over supergraphs of a graph (obscure and rarely useful)

  *SWIGTYPE\_p\_Agraph\_t* **gv.firstsupg** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agraph\_t* **gv.nextsupg** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agraph\_t sg);*\

- Iterate over edges of a graph

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstedge** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextedge** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over outedges of a graph

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstout** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextout** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over edges of a node

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstedge** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextedge** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over out-edges of a node

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstout** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextout** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over head nodes reachable from out-edges of a node

  *SWIGTYPE\_p\_Agnode\_t* **gv.firsthead** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.nexthead** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agnode\_t h);*\

- Iterate over in-edges of a graph

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstin** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextin** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over in-edges of a node

  *SWIGTYPE\_p\_Agedge\_t* **gv.firstin** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agedge\_t* **gv.nextin** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agedge\_t e);*\

- Iterate over tail nodes reachable from in-edges of a node

  *SWIGTYPE\_p\_Agnode\_t* **gv.firsttail** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.nexttail** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agnode\_t t);*\

- Iterate over nodes of a graph

  *SWIGTYPE\_p\_Agnode\_t* **gv.firstnode** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.nextnode** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agnode\_t n);*\

- Iterate over nodes of an edge

  *SWIGTYPE\_p\_Agnode\_t* **gv.firstnode** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *SWIGTYPE\_p\_Agnode\_t* **gv.nextnode** *(SWIGTYPE\_p\_Agedge\_t e, SWIGTYPE\_p\_Agnode\_t n);*\

- Iterate over attributes of a graph

  *SWIGTYPE\_p\_Agsym\_t* **gv.firstattr** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.nextattr** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_Agsym\_t a);*\

- Iterate over attributes of an edge

  *SWIGTYPE\_p\_Agsym\_t* **gv.firstattr** *(SWIGTYPE\_p\_Agedge\_t e);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.nextattr** *(SWIGTYPE\_p\_Agedge\_t e, SWIGTYPE\_p\_Agsym\_t a);*\

- Iterate over attributes of a node

  *SWIGTYPE\_p\_Agsym\_t* **gv.firstattr** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *SWIGTYPE\_p\_Agsym\_t* **gv.nextattr** *(SWIGTYPE\_p\_Agnode\_t n, SWIGTYPE\_p\_Agsym\_t a);*\

- **Remove graph objects**

  *bool* **gv.rm** *(SWIGTYPE\_p\_Agraph\_t g);*\
   *bool* **gv.rm** *(SWIGTYPE\_p\_Agnode\_t n);*\
   *bool* **gv.rm** *(SWIGTYPE\_p\_Agedge\_t e);*\

- **Layout**

  - Annotate a graph with layout attributes and values using a specific layout engine

  *bool* **gv.layout** *(SWIGTYPE\_p\_Agraph\_t g, string engine);*\

- **Render**

  - Render a layout into attributes of the graph

  *bool* **gv.render** *(SWIGTYPE\_p\_Agraph\_t g);*\

- Render a layout to stdout

  *bool* **gv.render** *(SWIGTYPE\_p\_Agraph\_t g, string format);*\

- Render to an open file

  *bool* **gv.render** *(SWIGTYPE\_p\_Agraph\_t g, string format, SWIGTYPE\_p\_FILE fout);*\

- Render a layout to an unopened file by name

  *bool* **gv.render** *(SWIGTYPE\_p\_Agraph\_t g, string format, string filename);*\

- Render to a string result

  *string* **gv.renderresult** *(SWIGTYPE\_p\_Agraph\_t ing, string format);*\
   **gv.renderresult** *(SWIGTYPE\_p\_Agraph\_t g, string format, string outdata);*\

- Render to an open channel

  *bool* **gv.renderchannel** *(SWIGTYPE\_p\_Agraph\_t g, string format, string channelname);*\

- Render a layout to a malloc'ed string, to be free'd by the caller

  - (deprecated - too easy to leak memory)

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

  *string* **gv.renderdata** *(SWIGTYPE\_p\_Agraph\_t g, string format);*\

- Writing graph back to file

  *bool* **gv.write** *(SWIGTYPE\_p\_Agraph\_t g, string filename);*\
   *bool* **gv.write** *(SWIGTYPE\_p\_Agraph\_t g, SWIGTYPE\_p\_FILE f);*\

- Graph transformation tools

  *bool* **gv.tred** *(SWIGTYPE\_p\_Agraph\_t g);*\

## KEYWORDS

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