{"id":9025,"library":"GvGen","title":"GvGen","description":"GvGen is a Python class designed to generate Graphviz DOT files, which are used to describe graphs. It provides a simple API for creating nodes, defining connections (edges), and applying various Graphviz properties to customize the appearance of the graph. The library simplifies the programmatic creation of complex graph structures, with its current version 1.0 focusing on stable functionality since its release in February 2020.","status":"maintenance","version":"1.0","language":"en","source_language":"en","source_url":"https://github.com/stricaud/gvgen/","tags":["graphviz","graph generation","dot language","visualization","data structures"],"install":[{"cmd":"pip install GvGen","lang":"bash","label":"Install GvGen"}],"dependencies":[{"reason":"GvGen generates '.dot' files. To render these files into image formats (like PNG, SVG, PDF), the Graphviz command-line utilities (e.g., 'dot' command) must be installed on the system. GvGen does not perform rendering itself.","package":"Graphviz","optional":false}],"imports":[{"symbol":"GvGen","correct":"from gvgen import GvGen"}],"quickstart":{"code":"import os\nfrom gvgen import GvGen\n\n# Create a new graph instance\ngraph = GvGen()\n\n# Create some nodes\nnode_a = graph.newItem(\"NodeA\")\nnode_b = graph.newItem(\"NodeB\")\nnode_c = graph.newItem(\"NodeC\")\n\n# Link nodes\ngraph.newLink(node_a, node_b)\ngraph.newLink(node_b, node_c, label=\"path\")\ngraph.newLink(node_c, node_a, \"back-ref\", style='dotted')\n\n# Add some properties to a node\ngraph.property(node_a, 'color', 'red')\ngraph.property(node_b, 'shape', 'box')\n\n# Output the DOT source to a file\ndot_file_path = \"example_graph.dot\"\nwith open(dot_file_path, \"w\") as f:\n    graph.dot(f)\n\nprint(f\"DOT file generated at: {dot_file_path}\")\nprint(\"To render this graph, ensure Graphviz is installed and run: \")\nprint(f\"  dot -Tpng {dot_file_path} -o example_graph.png\")\nprint(f\"  xdg-open example_graph.png # On Linux to view\")","lang":"python","description":"This quickstart demonstrates how to create a simple directed graph with nodes and edges using GvGen, apply basic styling, and then generate a Graphviz DOT file. It also provides instructions for rendering the DOT file into an image using the Graphviz command-line tool."},"warnings":[{"fix":"Install the Graphviz software suite on your operating system (e.g., `sudo apt-get install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS).","message":"GvGen strictly generates Graphviz DOT files and does not include functionality to render these files into images (e.g., PNG, SVG, PDF). You must have the Graphviz command-line tools (e.g., `dot`, `neato`) installed on your system to convert the generated `.dot` files into visual graphs.","severity":"gotcha","affected_versions":"1.0"},{"fix":"Be aware of the library's maintenance status. For new projects or if encountering issues with newer Python versions, consider using actively maintained alternatives like `pip install graphviz` (the official Graphviz Python binding) which offers similar functionality and active support.","message":"The GvGen library has not seen active development or new releases since version 1.0 in February 2020. While functional, it is in a maintenance state, meaning new features or prompt updates for major Python changes are unlikely. Users seeking more actively maintained or feature-rich Graphviz Python bindings might consider alternatives like the official `graphviz` Python package.","severity":"deprecated","affected_versions":"1.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install Graphviz on your operating system. For example, on Ubuntu/Debian: `sudo apt-get install graphviz`. On macOS with Homebrew: `brew install graphviz`. On Windows, download from graphviz.org and ensure it's added to your PATH.","cause":"The Graphviz command-line tools (specifically the 'dot' executable) are not installed or not accessible in your system's PATH.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'dot'"},{"fix":"Install the library using pip: `pip install GvGen`.","cause":"The GvGen Python package has not been installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'gvgen'"},{"fix":"Ensure you are calling `graph.dot(file_object)` after defining all nodes and links, and that the file is opened correctly for writing (e.g., `with open('output.dot', 'w') as f:`).","cause":"The `dot()` method of the GvGen object writes the graph definition to a file-like object. If it's not explicitly called, or if the file isn't properly opened in write mode, the output file will be empty or incorrect.","error":"My graph.dot file is empty or doesn't contain the graph definition."}]}