123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- 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
- it is possible to run sfg.c inside Linux kernel with a kernel module if graph routines are needed
-
- 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 or < 0 at error
-
- 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>
- The older tcl tk has it own small gui libaries and is maintained for Linux, android, os-x, windows and more
-
- 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.
-
- This sfg.c source is not sabotaged as some other open source software do
-
- /*
- * 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 */
-
|