{"id":24433192,"url":"https://github.com/windler/dotgraph","last_synced_at":"2025-04-12T14:32:58.846Z","repository":{"id":57498260,"uuid":"120194378","full_name":"windler/dotgraph","owner":"windler","description":"Go package to create and render graphviz dot graphs","archived":false,"fork":false,"pushed_at":"2018-10-29T12:00:58.000Z","size":14,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T09:04:37.059Z","etag":null,"topics":["dot","go","golang","graphviz","graphviz-dot","png","render"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/windler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-04T14:56:55.000Z","updated_at":"2023-12-05T03:24:14.000Z","dependencies_parsed_at":"2022-08-28T17:12:39.468Z","dependency_job_id":null,"html_url":"https://github.com/windler/dotgraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fdotgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fdotgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fdotgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windler%2Fdotgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windler","download_url":"https://codeload.github.com/windler/dotgraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581236,"owners_count":21128130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dot","go","golang","graphviz","graphviz-dot","png","render"],"created_at":"2025-01-20T16:21:39.017Z","updated_at":"2025-04-12T14:32:58.825Z","avatar_url":"https://github.com/windler.png","language":"Go","funding_links":[],"categories":["Content"],"sub_categories":["Language Bindings"],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/windler/dotgraph)](https://goreportcard.com/report/github.com/windler/dotgraph) [![CircleCI](https://circleci.com/gh/windler/dotgraph.svg?style=svg)](https://circleci.com/gh/windler/dotgraph) [![codebeat badge](https://codebeat.co/badges/ea2758da-b3f2-4de0-a051-effee8d9d499)](https://codebeat.co/projects/github-com-windler-dotgraph-master)\n\n# dotgraph\n`dotgraph` is a package that lets you create and render [graphviz dot graphs](https://www.graphviz.org/).\n\n## Installation\n```bash\ngo get github.com/windler/dotgraph/graph\ngo get github.com/windler/dotgraph/renderer\n```\n\nIf you want to render graphs make sure you have [graphviz](https://www.graphviz.org/) installed.\n\n## Usage\n### Creating a new graph\n```go\ngraph := graph.New(\"my_graph\")\n```\n\n### Adding nodes\n```go\ngraph.AddNode(\"first node\")\ngraph.AddNode(\"second node\")\ngraph.AddNode(\"third node\")\n```\n### Adding directed edges\n```go\ngraph.AddDirectedEdge(\"first node\", \"second node\", \"edge label\")\n```\n\n### Assiging dot graph attributes\nYou can apply any [dot attributes](https://graphviz.gitlab.io/_pages/doc/info/attrs.html).\n\n#### Graph attributes\n```go\ngraph.SetGraphOptions(dotgraph.DotGraphOptions{\n    \"bgcolor\": \"#333333\",\n})\n```\n\n#### Global node attributes\n```go\ngraph.SetNodeGraphOptions(dotgraph.DotGraphOptions{\n    \"fillcolor\": \"#336699\",\n    \"style\":     \"filled\",\n    \"fontcolor\": \"white\",\n    \"fontname\":  \"Courier\",\n    \"shape\":     \"rectangle\",\n})\n```\n\n#### Node attributes for nodes\nIf you want to assign attributes for nodes matching a pattern you can do the following:\n\n```go\ngraph.AddNodeGraphPatternOptions(\"first\", dotgraph.DotGraphOptions{\n    \"shape\": \"oval\",\n})\n```\n\n#### Global edge attributes\n```go\ngraph.SetEdgeGraphOptions(dotgraph.DotGraphOptions{\n    \"arrowhead\": \"open\",\n    \"color\":     \"white\",\n    \"fontcolor\": \"white\",\n    \"splines\":   \"curved\",\n})\n```\n\n#### Edge attributes \nIf you want to assign attributes for an edge that references a certain node you can do the following:\n\n```go\ngraph.AddEdgeGraphPatternOptions(\"first\", dotgraph.DotGraphOptions{\n    \"color\": \"black\",\n})\n```\n\n### Render a graph\n```go\nr := \u0026renderer.PNGRenderer{\n   OutputFile: \"/tmp/my_graph.png\",\n}\n\nr.Render(graph.String())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindler%2Fdotgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindler%2Fdotgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindler%2Fdotgraph/lists"}