-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME1
162 lines (127 loc) · 4.91 KB
/
README1
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
This is a single file graph layout library in c
which can be compiled-in or used as .a/.so library
The api programming interface is detailed in sfg.h
The only clib functions needed are calloc() and free()
The example program is sfgdemo.c and program ./sfgdemo
See also the wasm directory running sfg.c in the browser
To make the demo program sfgdemo type make
To cleanup use make clean
To indent the source use make indent
To check for memory leaks use make valgrind
To make libsfg.a library use make sfga
To make libsfg.so library use make sfgaso
To make javascript version use make emcc
To make python module with swig use make swigpython
To make perl module with swig use make swigperl
To make c++ with swig use make swigcplus
To make go with swig use make swiggo
To make java with swig use make swigjava
Also javascript, php, modula3 and more interfacing
to sfg.c can be generated with swig software
Using llvm compiler run scan-build-8 make
All routines in sfg.c return (int) 0 at oke status.
First all nodes must be added and then the edges.
For node or edge label a size of a rectangle to fit
the label text can be specified in (tx,ty) parameter.
Self-edges are allowed but not with a edgelabel.
After sfg_layout() the node and edge data can be
retrieved using a callback routine.
Also other data can be retrieved using sfg() routines
described in sfg.h
At error all routines return a < 0 negative value and
the meaning is described in sfg.h
The sfg.c routines only uses calloc() and free() from
the c-lib and nothing more than that.
The sfg.c does calculate node and edge positions but
has not a graph language parser or draw routines
which must be created by the user.
The sfg.c is usable for embedded software but it may
have high cpu+memory usage. sfg.c size is 120 Kb
The java version is in sfg.java size 336 Kb
There is a java dot language parser at http://www.alexander-merz.com/graphviz/
Using sfgdemo the sfgdemo.txt file is a graph which
can be edited and data directory has some more data.
Usage:
./sfgdemo
./sfgdemo input.txt output.svg
It compiles to javascript using emscripten emcc
When using swig software is can generate python interface
with make swigpython and specify include directory
Then tested with python-2.7:
python
>>> import sfg
>>> sfg.sfg_version()
10
>>>
When using swig software is can generate perl interface
with make swigperl
The use:
perl
use sfg;
print sfg::sfg_version(),"\n";
<ctrl-d>
10
There is a perl graphviz dot parser at https://metacpan.org/source/RSAVAGE/GraphViz2-Marpa-2.10
When using swig software is can generate tcl interface
with make swigtcl and specify include directory
Then tested:
tclsh
% load ./sfg.so sfg
% sfg_version
10
%
<ctrl-D>
Also javascript, php, modula3 and more interfacing
to sfg.c can be generated with swig software
http://www.swig.org/Doc3.0/Contents.html#Contents
Because this single-file library is a mini version of gml4gtk
it is possible to use gml4gtk and take a look at it's source.
In the java directory is the Java source and a jar file
To run the Java version of sfg use: java -jar sfg.jar
For php the ffi functions can be used with a sfg.so file
or it can be done using swig wrappers.
Because the sfg library can give the results of the relative
(x,y) coordinates of a node it is possible to create own
different way for absolyte (x,y) placement of the nodes.
The graphviz dot tool cannot do this.
/*
* Copyright t lefering
* parts are (C) Universitaet Passau 1986-1991
* parts are Copyright (C) 1998-2021 Free Software Foundation, Inc.
* parts are Copyright (C) Felix von Leitner from dietlibc
*
* https://notabug.org/mooigraph/sfgraph
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* These are the four essential freedoms with GNU GPL software:
* 1: freedom to run the program, for any purpose
* 2: freedom to study how the program works, and change it to make it do what you wish
* 3: freedom to redistribute copies to help your Free Software friends
* 4: freedom to distribute copies of your modified versions to your Free Software friends
* , ,
* / \
* ((__-^^-,-^^-__))
* `-_---' `---_-'
* `--|o` 'o|--'
* \ ` /
* ): :(
* :o_o:
* "-"
*
* SPDX-License-Identifier: GPL-3.0+
* License-Filename: LICENSE
*/
See also gml4gtk graph viewer on sourceforge.net, email is mooigraph on gmail.com
/* end */