-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
59 lines (43 loc) · 2.02 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
__ __ __ _ __
/ / ____ ____ _________/ /___ _/ /__ (_) /____ __/|_
/ / / _ \/ __ \/ ___/ __ / __ `/ / _ \/ / __/ _ \ | /
/ /___/ /_/ / / / (__ ) /_/ / /_/ / / __/ / /_/ __/ /_ __|
/_____/\____/_/ /_/____/\__,_/\__,_/_/\___/_/\__/\___/ |/
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.