You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
varmyNode=newDotNode().WithIdentifier("MyNode").WithShape(DotNodeShape.Ellipse).WithLabel("My node!").WithFillColor(DotColor.Coral).WithFontColor(DotColor.Black).WithStyle(DotNodeStyle.Dotted).WithWidth(0.5).WithHeight(0.5).WithPenWidth(1.5);// Add the node to the graphgraph.Add(myNode);
Create and add an edge (DotEdge)
// Create an edge with identifiersvarmyEdge=newDotEdge().From("Node1").To("Node2");// Or with nodes and attributesvarmyEdge=newDotEdge().From(node1).To(node2).WithArrowHead(DotEdgeArrowType.Box).WithArrowTail(DotEdgeArrowType.Diamond).WithColor(DotColor.Red).WithFontColor(DotColor.Black).WithLabel("My edge!").WithStyle(DotEdgeStyle.Dashed).WithPenWidth(1.5);// Add the edge to the graphgraph.Add(myEdge);
Create a subgraph / cluster
// Subgraph identifier need to start with "cluster" to be identified as a clustervarmySubgraph=newDotSubgraph().WithIdentifier("cluster_0");// Create a subgraph with attributes (only used for cluster)varmySubgraph2=newDotSubgraph().WithIdentifier("cluster_1").WithColor(DotColor.Red).WithStyle(DotSubGraphStyle.Dashed).WithLabel("My subgraph!");// Add node, edge, subgraphsubGraph.Add(myNode);subGraph.Add(myEdge);subGraph.Add(mySubgraph2);// Add subgraph to main graphgraph.Add(mySubgraph);
Compile to DOT format
awaitusingvarwriter=newStringWriter();varcontext=newCompilationContext(writer,newCompilationOptions());awaitgraph.CompileAsync(context);varresult=writer.GetStringBuilder().ToString();// Save it to a fileFile.WriteAllText("graph.dot",result);