Skip to content

a lightweight Graphviz preparation utility for answer set programming

License

Notifications You must be signed in to change notification settings

rndmcnlly/Lonsdaleite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

    __                         __      __     _ __
   / /   ____  ____  _________/ /___ _/ /__  (_) /____     __/|_
  / /   /  _ \/ __ \/ ___/ __  / __ `/ / _ \/ / __/ _ \   |    /
 / /___/ /_/ / / / (__  ) /_/ / /_/ / /  __/ / /_/  __/  /_ __|
/_____/\____/_/ /_/____/\__,_/\__,_/_/\___/_/\__/\___/    |/
                      for intensely structured graphs

OVERVIEW
  Lonsdaleite is a lightweight Python utility for preparing Graphviz [1] graphs
  from the output of answer set solvers. It is intended to map nearly all of
  Graphviz's language (notably excepting subgraphs).

  [1] http://www.graphviz.org/

USAGE
  Lonsdaleite expects a description of the desired graph encoded as ground
  facts, one per line, in AnsProlog syntax (in the format you would feed to a
  solver).

  $ cat some_ground_graph_instance.lp | lonsdaleite | dot
  or
  $ clingo example.lp | lonsdaleite -dcub

OPTIONS
  -d  dump graph after parsing
  -c  expect input piped from Clasp's output
  -u  construct URL for Google's GraphViz Charts API
  -b  open that URL in the default web browser

MODELING INTERFACE

  graphviz_engine(Engine)  -- dot|neato|fdp|sfdp|twopi|circo (default: dot)

  graphviz_graph_type(Type) -- graph|digraph (default: graph)

  graphviz_node(N)         -- N must be a graphviz-friendly identifier

  graphviz_edge(N1,N1)

  graphviz_graph_attr(K,V) -- K: attribute name, V: attribute value
  graphviz_node_attr(N,K,V)
  graphviz_edge_attr(N1,N1,K,V)

  graphviz_global_node_attr(K,V)
  graphviz_global_edge_attr(K,V)

HINTS
  Look at the Lua code embedded in example.lp for a helper function that can be
  used to easily build complex strings for use as attribute values.

  INPUT: graphviz_node_attr(N,pos,@format("%s,%s!",X,Y)) :- at(N,X,Y).
  OUTPUT: graphviz_node_attr(b,pos,"5,5!")
  NOTE: Use the neato engine if you are generating the pos attribute with ASP.
      

CAVEATS
  When using the -c option, Lonsdaleite splits the answer set line on spaces
  before parsing any of the terms. Avoid embedded spaces in your terms when
  using this option. 

About

a lightweight Graphviz preparation utility for answer set programming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages