Graphics

Catlab.Graphics.GraphvizModule

AST and pretty printer for Graphviz's DOT language.

References:

  • DOT grammar: http://www.graphviz.org/doc/info/lang.html
  • DOT language guide: http://www.graphviz.org/pdf/dotguide.pdf
Catlab.Graphics.Graphviz.run_graphvizMethod

Run a Graphviz program.

Assumes that Graphviz is installed on the local system and invokes Graphviz through its command-line interface.

For bindings to the Graphviz C API, see the the GraphViz.jl package (https://github.com/Keno/GraphViz.jl). GraphViz.jl is unmaintained at the time of this writing.

Catlab.Graphics.Graphviz.to_graphvizMethod

Convert an attributed graph (MetaGraph) to a Graphviz graph.

This method is usually more convenient than direct AST manipulation for creating Graphviz graphs. It supports graphs that are directed or undirected, simple or multi-edged. For more advanced features, like nested subgraphs, you must use the Graphviz AST directly.

Catlab.Graphics.Graphviz.to_graphvizMethod

Draw a wiring diagram using Graphviz.

The input f can also be a morphism expression, which is converted into a wiring diagram.

Arguments

  • graph_name="G": name of Graphviz digraph
  • orientation=TopToBottom: orientation of layout. One of LeftToRight, RightToLeft, TopToBottom, or BottomToTop.
  • node_labels=true: whether to label the nodes
  • labels=false: whether to label the edges
  • label_attr=:label: what kind of edge label to use (if labels is true). One of :label, :xlabel, :headlabel, or :taillabel.
  • port_size="24": minimum size of ports on box, in points
  • junction_size="0.05": size of junction nodes, in inches
  • outer_ports=true: whether to display the outer box's input and output ports. If disabled, no incoming or outgoing wires will be shown either!
  • anchor_outer_ports=true: whether to enforce ordering of the outer box's input and output, i.e., ordering of the incoming and outgoing wires
  • graph_attrs=default_graph_attrs: top-level graph attributes
  • node_attrs=default_node_attrs: top-level node attributes
  • edge_attrs=default_edge_attrs: top-level edge attributes
  • cell_attrs=default_cell_attrs: main cell attributes in node HTML-like label
Catlab.Graphics.TikZModule

AST and pretty printer for TikZ.

This module does not provide bindings to the TikZ LaTeX package. For that, see the TikzPictures.jl package: https://github.com/sisl/TikzPictures.jl

The AST is large but still incomplete! It supports:

  • Nodes (\node) and edges (\draw)
  • Nodes along edges (\draw ... node ...)
  • Graphs (\graph)
  • Matrices (\matrix)
  • Scopes and nested pictures

The AST is adapted from the (also incomplete) BNF grammar for TikZ in TikZit.

Catlab.Graphics.YFilesWiringDiagramsModule

Deserialize abstract wiring diagram from yFiles.

Reads a wiring diagram from the GraphML dialect used by yEd and yFiles. Unlike the GraphML spec, the yEd data model does not explicitly include ports:

  • https://yed.yworks.com/support/qa/102/
  • https://yed.yworks.com/support/qa/2531/

We infer the ports of boxes and their order from the geometry of the diagram. Thus, this module has the nature of a hack. While it may be useful for interactive and exploratory work, it should not be used in a production system.