Have you looked at Graphviz? It's an opensource project that generates diagrams from graphs, it's used for example in doxygen to generate class diagrams. Good for inspiration.
Is there anything like graphviz, which can give you a nice programatic interface to create UML/BPMN graphs? Graphviz output is rough, you'd figure that in 2013 we'd have a bit better looking graphs.