On the art and science of algorithmic line drawings for representing graphical models.
Daft is a Python package that uses matplotlib to render pixelperfect probabilistic graphical models for publication in a journal or on the internet. With a short Python script and an intuitive modelbuilding syntax you can design directed (Bayesian Networks, directed acyclic graphs) and undirected (Markov random fields) models and save them in any formats that matplotlib supports (including PDF, PNG, EPS and SVG).

Laura Dietz and Jaakko Luttinen made tikz macros for doing this in LaTeX, tikzbayesnet

Do it in your browser! daggity:
DAGitty is a browserbased environment for creating, editing, and analyzing causal models (also known as directed acyclic graphs or causal Bayesian networks).
 TETRAD is less for sketching idealised DAGs than for visualising and calculating giant empirical DAGs. It’s written by very fancy and famous causality inference people.
Tetrad is a program which creates, simulates data from, estimates, tests, predicts with, and searches for causal and statistical models. The aim of the program is to provide sophisticated methods in a friendly interface requiring very little statistical sophistication of the user and no programming knowledge. It is not intended to replace flexible statistical programming systems such as Matlab, Splus or R. Tetrad is freeware that performs many of the functions in commercial programs such as Netica, Hugin, LISREL, EQS and other programs, and many discovery functions these commercial programs do not perform.
Tetrad is limited to models of categorical data (which can also be used for ordinal data) and to linear models (“structural equation models’) with a Normal probability distribution, and to a very limited class of time series models. The Tetrad programs describe causal models in three distinct parts or stages: a picture, representing a directed graph specifying hypothetical causal relations among the variables; a specification of the family of probability distributions and kinds of parameters associated with the graphical model; and a specification of the numerical values of those parameters.
After initializing a new DAG using a command line, the researcher can evaluate what associations are introduced by adjusting for covariables. Potentially biasing paths from exposure to outcome can be identified (see eFig. 1, http://links.lww.com/EDE/A395 demonstrating harmful adjustment using an example DAG from Fleischer and Diez Roux3). Functions to conveniently add or remove nodes and arcs are included, as is a function checking introduced associations and biasing paths for all possible adjustment sets […] The graphics capabilities of R allow fairly straightforward programming of basic DAG drawing routines, while also supporting the interactive repositioning of nodes and arcs.

graphviz is nearly good, in that it supports graphing arbitrary DAGs. Inevitably, none of its fancy algorithms every lay it out quite like you want. There is an OSX gui and a crossplatform (WX) gui called doteditor.
 there is a python graphviz wrapper
 Aaaaaand it renders in jupyter. (see also other jupyter options)
 And it runs in R with lots of other trendy webish javascripty stuff]({filename}javascript_visualisations.md) via diagrammeR
 and traditional style using Rgraphviz
 You probably want it to work mathematically; there is a TeX backend, called dot2tex.

mermaid is a light JSonlinefocussed graphvizlike thing that integrates with many markdown editors