csdot 2.0.0
See the version list below for details.
dotnet add package csdot --version 2.0.0
NuGet\Install-Package csdot -Version 2.0.0
<PackageReference Include="csdot" Version="2.0.0" />
paket add csdot --version 2.0.0
#r "nuget: csdot, 2.0.0"
// Install csdot as a Cake Addin #addin nuget:?package=csdot&version=2.0.0 // Install csdot as a Cake Tool #tool nuget:?package=csdot&version=2.0.0
csdot
A c# library to process the Dot language used by Graphviz.
Why csdot?
- Easy and in tune.
- Maximum number of attributes are supported as defined by the DOT grammar.
- 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.
- Attribute code is generated by python from json data making it scalable.
- Simple API's for dot Elements and Attributes with Load and Save Support.
- Continuous development and intergration with new feature updates.
- Tracking of known bugs and quick support for user based issue.
- Listed on Graphviz - Resources [https://graphviz.org/resources/]
Development occurs at GitHub, where you can report issues and request enhancement.
Usage:
Just import the library for your respective framework and start working!
csdot library
In csdot: graph, node, edge, subgraph, clusters are represented as Elements (implements IDot interface for grouping).
As they are grouped, they can be added to the root element using a single function:
public void AddElement(IDot i_dot)
To add multiple attribute to root element, you can use:
public void AddElements(params IDot [] i_dot)
Each element generated a unique ID UID which refers to that particular element. One can access it by calling:
var unique_id = graph.uid
(Considering graph
is object of class Graph
)
Elements of Dot
Graph:
To create a graph
Graph graph = new Graph("id"); // where id is the graph-ID string.
To set type 'strict'
graph.strict = true;
To set the type 'graph' or 'diagraph'
graph.type = "graph";
Node:
To create a node:
Node node = new Node("id"); // where id is the node-id
To set the compass point:
node.compassPoint = DataTypes.CompassPoint.North;
(Will explain the DataTypes later in this thread)
Edge:
To create an edge, we need to add a transition. A Transition is an element of edge.
Node a = new Node("a");
Node b = new Node("b");
Node c = new Node("c");
Edge edge = new Edge();
List<Transition> transition = new List<Transition>()
{
new Transition(a, EdgeOp.directed),
new Transition(b, EdgeOp.undirected),
new Transition(c, EdgeOp.unspecified)
};
edge.Transition = transition;
Transition also supports ID:
List<Transition> transition = new List<Transition>()
{
new Transition("a", EdgeOp.directed),
new Transition("b", EdgeOp.unspecified)
};
Edge edge = new Edge(transition);
Here no node is created, and the edge is created using the ID. Edge also supports adding of Elements.
Add elements to a root(like Graph, Subgraph):
graph.AddElement(node)
graph.AddElement(edge)
or you can directly call:
graph.AddElements(node, edge)
Attributes
Each element of Dot can have its respective attribute as defined in the dot guidelines. In csdot, we have covered many attributes respective to the type specified.
Set the value of attribute
The 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:
graph.Attribute.center.Value = true;
This will set the center attribute of graph. The generated graph will have this attribute.
Removing attribute from Element using Set property
Natrually 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.
You can remove the attribute by setting the Set
property of that attribute to false
graph.Attribute.center.Set = false;
To set Node attribute "color"
node.Attribute.color.Value = Color.X11.darkviolet;
Default and Minimum:
Also we can get the default and minimum as well as set the default and minimum.
graph.Attribute.center.SetDefault();
To Set Minimum
graph.Attribute.voro_margin.SetMinimum();
Simiarly to Get default and minimum, one can invoke GetDefault()
GetMinimum()
DataTypes
A 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:
public class point
is one such example.
Attributes currently not added:
- esep
- headport
- layer
- layers
- layerselect
- normalize
- orientation
- pad
- page
- pagedir
- quadtree
- ratio
- sep
- size
- start
- style
- tailport
- vertices
- viewport
These will be added in the upcoming versions and well as LoadDiagraph feature.
The 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.
There are multiple known issues in the Attribute segment like handling of multi-types (string/double) as well as multi-default and multi-minimum. Please refer doc: csdot\Docs\Attribute Status.docs for more info
DotDocument
To load and save a file, you need to create a DotDocument object.
To save, you can call the API mentioned below:
public void SaveToFile(Graph i_graph, string i_fileLocation)
To load a graph you can call:
public Graph LoadDigraph(string i_fileLocation)
This will load the dot from the given file location and return a graph object.
License:
Distributed under MIT license.
Contacts:
Harsh (harshsikhwal7@gmail.com) Vibaswan (vroychowdhury@gmail.com)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.