{"id":22188379,"url":"https://github.com/harshsikhwal/csdot","last_synced_at":"2025-07-26T20:32:06.288Z","repository":{"id":143215471,"uuid":"340325402","full_name":"harshsikhwal/csdot","owner":"harshsikhwal","description":"A c# based DOT (graphviz) framework","archived":false,"fork":false,"pushed_at":"2021-10-04T11:35:16.000Z","size":7139,"stargazers_count":33,"open_issues_count":12,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-01T16:49:08.861Z","etag":null,"topics":["csharp","dot","dotfiles","dotnetcore","edge","graph","graphviz","graphviz-dot","graphviz-dot-language","library","netcore","netframework","netstandard20","nuget","subgraph","transition"],"latest_commit_sha":null,"homepage":"https://graphviz.org/resources/","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/harshsikhwal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-02-19T09:50:47.000Z","updated_at":"2024-11-01T06:48:46.000Z","dependencies_parsed_at":"2024-06-20T23:29:01.292Z","dependency_job_id":"bc1d42a1-9786-4809-989f-615c6ce9af98","html_url":"https://github.com/harshsikhwal/csdot","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshsikhwal%2Fcsdot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshsikhwal%2Fcsdot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshsikhwal%2Fcsdot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harshsikhwal%2Fcsdot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harshsikhwal","download_url":"https://codeload.github.com/harshsikhwal/csdot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227640321,"owners_count":17797777,"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","dotfiles","dotnetcore","edge","graph","graphviz","graphviz-dot","graphviz-dot-language","library","netcore","netframework","netstandard20","nuget","subgraph","transition"],"created_at":"2024-12-02T11:09:58.556Z","updated_at":"2024-12-02T11:09:59.727Z","avatar_url":"https://github.com/harshsikhwal.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# csdot\n![Nuget](https://img.shields.io/nuget/v/csdot?style=for-the-badge)\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/harshsikhwal/csdot?style=for-the-badge)\n\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/harshsikhwal/csdot/Csdot_Build?style=plastic)\n[![GitHub issues](https://img.shields.io/github/issues/harshsikhwal/csdot?style=plastic)](https://github.com/harshsikhwal/csdot/issues)\n[![GitHub stars](https://img.shields.io/github/stars/harshsikhwal/csdot?style=plastic)](https://github.com/harshsikhwal/csdot/stargazers)\n[![GitHub license](https://img.shields.io/github/license/harshsikhwal/csdot?style=plastic)](https://github.com/harshsikhwal/csdot/blob/main/LICENSE)\n![GitHub contributors](https://img.shields.io/github/contributors/harshsikhwal/csdot?style=plastic)\n![Nuget](https://img.shields.io/nuget/dt/csdot)\n\nA c# library to process the Dot language used by Graphviz.\n\n## Why csdot?\n* Easy and in tune.\n* Maximum number of attributes are supported as defined by the DOT grammar.\n* Support of custom attribute: the user can sync code and add custom attribute to the json to generate specific class or can use the inbuilt custom attribute present.\n* Attribute code is generated by python from json data making it scalable.\n* Simple API's for dot Elements and Attributes with Load and Save Support.\n* Continuous development and intergration with new feature updates.\n* Tracking of known bugs and quick support for user based issue.\n* Listed on Graphviz - Resources [https://graphviz.org/resources/]\n\nDevelopment occurs at GitHub, where you can report issues and request enhancement.\nRequires python(2-3) to build. \n\n## Usage:\n\nJust import the library for your respective framework and start working!\n\n## csdot library\n\nIn csdot: **graph**, **node**, **edge**, **subgraph**, **clusters** are represented as Elements (implements IDot interface for grouping). \n\nAs they are grouped, they can be added to the root element using a single function: \n```public void AddElement(IDot i_dot)``` \n\nTo add multiple attribute to root element, you can use:\n```public void AddElements(params IDot [] i_dot)```\n\nEach element generated a unique ID  **UID** which refers to that particular element. One can access it by calling:\n```csharp\nvar unique_id = graph.uid\n``` \n(*Considering ```graph``` is object of ```class Graph```*)\n\n### Elements of Dot \n\n#### Graph:\n\nTo create a graph\n```csharp\nGraph graph = new Graph(\"id\");          // where id is the graph-ID string.\n```\n\nTo set type 'strict'\n```csharp\ngraph.strict = true;\n```\n\nTo set the type 'graph' or 'diagraph'\n```csharp\ngraph.type = \"graph\";\n```\n\n#### Node:\n\nTo create a node:\n```csharp\nNode node = new Node(\"id\");\t\t// where id is the node-id\n```\n\nTo set the compass point:\n```csharp\nnode.compassPoint = DataTypes.CompassPoint.North;\n```\n(Will explain the DataTypes later in this thread)\n\n#### Edge:\n\nTo create an edge, we need to add a transition. A Transition is an element of edge.\n```csharp\nNode a = new Node(\"a\");\nNode b = new Node(\"b\");\nNode c = new Node(\"c\");\nEdge edge = new Edge();\nList\u003cTransition\u003e transition = new List\u003cTransition\u003e()\n{\n\tnew Transition(a, EdgeOp.directed),\n\tnew Transition(b, EdgeOp.undirected),\n\tnew Transition(c, EdgeOp.unspecified)\n};\nedge.Transition = transition;\n```\n\nTransition also supports ID:\n```csharp\nList\u003cTransition\u003e transition = new List\u003cTransition\u003e()\n{\n\tnew Transition(\"a\", EdgeOp.directed),\n\tnew Transition(\"b\", EdgeOp.unspecified)\n};\nEdge edge = new Edge(transition);\n```\nHere no node is created, and the edge is created using the *ID*. Edge also supports adding of Elements.\n\n#### Add elements to a root(like Graph, Subgraph):\n```csharp\ngraph.AddElement(node)\ngraph.AddElement(edge)\n```\n\nor you can directly call:\n```csharp\ngraph.AddElements(node, edge)\n```\n\n### Attributes\n\nEach element of Dot can have its respective attribute as defined in the dot guidelines.\nIn csdot, we have covered many attributes respective to the type specified.\n\n#### Set the value of attribute\nThe attributes are present in Attribute property of every element. Therefore to set a specific attribute, you need to call the property, which contains all the attribute objects and set its value as mentioned here:\n```csharp\ngraph.Attribute.center.Value = true;\n```\nThis will set the center attribute of graph. The generated graph will have this attribute.\n\n#### Removing attribute from Element using Set property\n\nNatrually the attributes are just defined but not added to the element. Once the value is set for a particular attribute, it is added to the element. \n\nYou can remove the attribute by setting the ```Set``` property of that attribute to ```false```\n```csharp\ngraph.Attribute.center.Set = false;\n```\n\nTo set Node attribute \"color\"\n```csharp\nnode.Attribute.color.Value = Color.X11.darkviolet;\n```\n#### Default and Minimum:\n\nAlso we can get the default and minimum as well as set the default and minimum.\n```csharp\ngraph.Attribute.center.SetDefault();\n```\n\nTo Set Minimum\n```csharp\ngraph.Attribute.voro_margin.SetMinimum();\n```\n\nSimiarly to Get default and minimum, one can invoke ```GetDefault()``` ```GetMinimum()```\n\n#### DataTypes\n\nA few inbuilt classes are defined where the developer can check the available list of properties and set accordingly. Like ```Color``` in namespace ```namespace csdot.Attributes.DataTypes``` can be used. Most of these are static classes where the const data is present. Others are created for attributes supporting derived datatypes:\n```csharp\npublic class point\n```\nis one such example. \n\n#### Attributes currently not added:\n\n* esep\n* headport\n* layer\n* layers\n* layerselect\n* normalize\n* orientation\n* pad\n* page\n* pagedir\n* quadtree\n* ratio\n* sep\n* size\n* start\n* style\n* tailport\n* vertices\n* viewport\n\nThese will be added in the upcoming versions.\n\nThe attributes having List as their secondary datatype and string as their first datatype, like color, fillcolor takes string Value. There is no list defined for such attributes. However for ranksep, a secondary holder, ValueList is added to support double datatype. \n\nThere are multiple known issues in the Attribute segment like handling of multi-types (string/double) as well as multi-default and multi-minimum. \nPlease refer doc: *csdot\\Docs\\Attribute Status.docs* for more info\n\n### DotDocument\n\nTo load and save a file, you need to create a DotDocument object.\n\nTo save, you can call the API mentioned below:\n```csharp\npublic void SaveToFile(Graph i_graph, string i_fileLocation)\n```\n\nTo load a graph you can call:\n```csharp\npublic Graph LoadDigraph(string i_fileLocation)\n```\n\nThis will load the dot from the given file location and return a graph object.\n\n\n## License:\nDistributed under MIT license.\n\n## Contacts:\n\n**Harsh**     (harshsikhwal7@gmail.com)\n**Vibaswan**  (vroychowdhury@gmail.com)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshsikhwal%2Fcsdot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshsikhwal%2Fcsdot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshsikhwal%2Fcsdot/lists"}