{"id":25609557,"url":"https://github.com/vfrz/dotnetgraph","last_synced_at":"2025-04-05T06:07:48.118Z","repository":{"id":41092852,"uuid":"106164871","full_name":"vfrz/DotNetGraph","owner":"vfrz","description":"Create GraphViz DOT graph with .NET / C#","archived":false,"fork":false,"pushed_at":"2024-07-13T09:35:36.000Z","size":149,"stargazers_count":99,"open_issues_count":10,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-05T06:07:42.892Z","etag":null,"topics":["csharp","dot","dotnet","dotnetcore","graph","graphviz","graphviz-dot","graphviz-dot-language","netcore","netstandard","netstandard20"],"latest_commit_sha":null,"homepage":"","language":"C#","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/vfrz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-08T09:37:38.000Z","updated_at":"2025-03-06T06:12:50.000Z","dependencies_parsed_at":"2025-02-28T23:00:32.938Z","dependency_job_id":"1850f8bb-1477-4100-a7da-b6f97207ca8f","html_url":"https://github.com/vfrz/DotNetGraph","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfrz%2FDotNetGraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfrz%2FDotNetGraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfrz%2FDotNetGraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfrz%2FDotNetGraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfrz","download_url":"https://codeload.github.com/vfrz/DotNetGraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294539,"owners_count":20915340,"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":["csharp","dot","dotnet","dotnetcore","graph","graphviz","graphviz-dot","graphviz-dot-language","netcore","netstandard","netstandard20"],"created_at":"2025-02-21T21:41:10.443Z","updated_at":"2025-04-05T06:07:48.102Z","avatar_url":"https://github.com/vfrz.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DotNetGraph\n\n![Logo](Resources/icon_64.png)\n\nCreate **GraphViz DOT graph** with **dotnet** (compatible with **.NET Standard 2.0** and higher).\n\nCurrent stable version: [![#](https://img.shields.io/nuget/v/DotNetGraph.svg)](https://www.nuget.org/packages/DotNetGraph/)\n\nLatest version: [![#](https://img.shields.io/nuget/vpre/DotNetGraph.svg)](https://www.nuget.org/packages/DotNetGraph/absoluteLatest)\n\n# Usage\n\n## Create a graph (*DotGraph*)\n\n```csharp\nvar graph = new DotGraph().WithIdentifier(\"MyGraph\");\n\nvar directedGraph = new DotGraph().WithIdentifier(\"MyDirectedGraph\").Directed();\n```\n\n## Create and add a node (*DotNode*)\n\n```csharp\nvar myNode = new DotNode()\n    .WithIdentifier(\"MyNode\")\n    .WithShape(DotNodeShape.Ellipse)\n    .WithLabel(\"My node!\")\n    .WithFillColor(DotColor.Coral)\n    .WithFontColor(DotColor.Black)\n    .WithStyle(DotNodeStyle.Dotted)\n    .WithWidth(0.5)\n    .WithHeight(0.5)\n    .WithPenWidth(1.5);\n\n// Add the node to the graph\ngraph.Add(myNode);\n```\n\n## Create and add an edge (*DotEdge*)\n\n```csharp\n// Create an edge with identifiers\nvar myEdge = new DotEdge().From(\"Node1\").To(\"Node2\");\n\n// Or with nodes and attributes\nvar myEdge = new DotEdge()\n    .From(node1)\n    .To(node2)\n    .WithArrowHead(DotEdgeArrowType.Box)\n    .WithArrowTail(DotEdgeArrowType.Diamond)\n    .WithColor(DotColor.Red)\n    .WithFontColor(DotColor.Black)\n    .WithLabel(\"My edge!\")\n    .WithStyle(DotEdgeStyle.Dashed)\n    .WithPenWidth(1.5);\n\n// Add the edge to the graph\ngraph.Add(myEdge);\n```\n\n## Create a subgraph / cluster\n\n```csharp\n// Subgraph identifier need to start with \"cluster\" to be identified as a cluster\nvar mySubgraph = new DotSubgraph().WithIdentifier(\"cluster_0\");\n\n// Create a subgraph with attributes (only used for cluster)\nvar mySubgraph2 = new DotSubgraph()\n    .WithIdentifier(\"cluster_1\")\n    .WithColor(DotColor.Red)\n    .WithStyle(DotSubGraphStyle.Dashed)\n    .WithLabel(\"My subgraph!\");\n\n// Add node, edge, subgraph\nsubGraph.Add(myNode);\nsubGraph.Add(myEdge);\nsubGraph.Add(mySubgraph2);\n\n// Add subgraph to main graph\ngraph.Add(mySubgraph);\n```\n\n## Compile to DOT format\n\n```csharp\nawait using var writer = new StringWriter();\nvar context = new CompilationContext(writer, new CompilationOptions());\nawait graph.CompileAsync(context);\n\nvar result = writer.GetStringBuilder().ToString();\n\n// Save it to a file\nFile.WriteAllText(\"graph.dot\", result);\n```\n\u003chr\u003e\n\n### Credits\n\nLogo: https://www.flaticon.com/free-icon/flow-chart_4411911","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfrz%2Fdotnetgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfrz%2Fdotnetgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfrz%2Fdotnetgraph/lists"}