How to modify Graphviz to allow custom graph type?

Hello everyone,

I am pretty new to Graphviz but I think it's a great, easy to use tool for developing diagrams. However, for my purposes I will be developing the same kind of graphs (share same attributes and even some nodes) and I was wondering if there's a way to modify Graphviz to support my custom graph type. What I mean by this is that when creating a graph (as of right now), one has two options: graph or digraph. But I want to add "mygraph" as a third option supported by graphviz, so now a user has three available types of graphs: graph, digraph, and mygraph.

My reason for doing this is that the graphs I create share the same attributes and even a couple of nodes, and I thought it would useful if I could modify Graphviz to support a custom-made graph type, so that every time I create a graph I can specify that it's mygraph (which is in essence is a digraph with some specific attributes set), and the attributes will automatically be set for me, behind the curtains so to speak.

So far I have setup LXR to help me explore through the source code of Graphviz but I must admit, it's a bit overwhelming. Does anyone have any idea how I could go about achieving my goal? Any hints would be greatly appreciated.

Thanks!

Recent comments