Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
/ nimgraphviz Public archive

A nim library for making graphs with GraphViz and DOT (based on PyGraphviz)

Notifications You must be signed in to change notification settings

QuinnFreedman/nimgraphviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Archived. This library has been moved to https://github.com/Aveheuzed/nimgraphviz


nimgraphviz

The nimgraphviz module is a library for making graphs using GraphViz based on PyGraphviz.

To use it, add

requires "nimgraphviz >= 0.2.0"

to your .nimble file.

To export images, you must have GraphViz installed. Download it here: https://graphviz.gitlab.io/download.

Read the docs here.

Here is an example of creating a simple graph:

# create a directed graph
var graph = newGraph(directed=true)

# set some attributes of the graph:
graph.graphAttr.add("fontsize", "32")
graph.graphAttr.add("label", "Test Graph")

# add edges:
# (if a node does not exist already it will be created automatically)
graph.addEdge("a", "b", "a-to-b", [("label", "A to B")])
graph.addEdge("c", "b", "c-to-b", [("style", "dotted")])
graph.addEdge("b", "a", "b-to-a")
graph.addNode("c", [("color", "blue"), ("shape", "box"),
                        ("style", "filled"), ("fontcolor", "white")])
graph.addNode("d", [("lable", "node")])

# if you want to export the graph in the DOT language,
# you can do it like this:
# echo graph.exportDot()

# Export graph as PNG:
graph.exportImage("test_graph.png")

About

A nim library for making graphs with GraphViz and DOT (based on PyGraphviz)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages