Mohammed Atef’s Technical blog

Directed Graph Markup Language(DGML)


DGML (Directed Graph Markup Language) is Microsoft use in VSTS 2010 Architecture to render graphs the power of DGML is in its simplicity.

Using DGML Code
if you have Visual Studio 2010 CTP you can add new file and rename it with dgml extension then add the following lines of code

<DirectedGraph xmlns=>
  <Nodes>      </Nodes>
  <Links>      </Links>

The DirectedGraph node used to inform Visual studio that we have DGML file. Nodes list contain all nodes for this diagram and Links determine the link between Nodes.

Yes it is very simple, let’s see what happen if you need to add to nodes like the below Image


Directed Graph Markup Language

Directed Graph Markup Language

 Just write the following code

<DirectedGraph xmlns=>
  <Nodes>      </Nodes>
  <Links>    <Link Source=From Target=To />  </Links>

 You can notice that we just add one line which tells the Visual Studio that we have Source node From and Target Node is To.
I think you get it now, you can add any number of related nodes with this simple code


What happen if you need to group number of nodes into one single node? It is very simple you can create Container which can group number of nodes.
You can create container with adding two few lines of code as follows

<Node Id=My containner Group=Expanded/>
Link Source=My containner Target=From Category=Contains/>

So if you need to draw diagram like the below one


Directed Graph Markup Language

Directed Graph Markup Language

Just write this few lines of code

<DirectedGraph xmlns=>
  <Nodes>    <Node Id=My containner Group=Expanded/>  </Nodes>
    <Link Source=From Target=To />
    <Link Source=My containner Target=From Category=Contains/>

Actually VSTS 2010 CTP use DGML for draw all architecture for assemblies, namespace, classes and method.
It is very useful for any developer to understand the architecture for old exist systems, now you can do this by click View->Architecture
Explorer from Visual Studio IDE as shown below


VS 2010 CTP Architecture Explorer

VS 2010 CTP Architecture Explorer


 Really thank you Microsoft for this great product. I think Microsoft has been covered a lot of our needs in our Software Lifecycle.Hope this help….


March 30, 2009 Posted by | .Net 2010 | , , | Leave a comment