csdot 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package csdot --version 1.0.2                
NuGet\Install-Package csdot -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="csdot" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add csdot --version 1.0.2                
#r "nuget: csdot, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install csdot as a Cake Addin
#addin nuget:?package=csdot&version=1.0.2

// Install csdot as a Cake Tool
#tool nuget:?package=csdot&version=1.0.2                

csdot

Nuget

GitHub release (latest by date)

GitHub Workflow Status GitHub issues GitHub stars GitHub license GitHub contributors Nuget

A c# library to process Dot language used by Graphviz.

Currently it can generate DOT and dump as a file

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
  • ranksep
  • ratio
  • sep
  • size
  • start
  • style
  • tailport
  • vertices
  • viewport

These will be added in the upcoming versions and well as LoadDiagraph feature.

There are multiple known issues in the Attribute segment like handling of multi-types (color and colorList) 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.

The current release do not support Loading of the graph, but you can save it by calling the API mentioned below:

public void SaveToFile(Graph i_graph, string i_fileLocation)

License:

Distributed under MIT license.

Contacts:

Harsh (harshsikhwal7@gmail.com) Vibaswan (vroychowdhury@gmail.com)

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
2.0.1 15,060 5/7/2021
2.0.0 419 4/25/2021
1.0.3 437 3/13/2021
1.0.2 323 3/9/2021
1.0.1 349 3/4/2021
1.0.0 365 3/1/2021