📄 readme
字号:
C++ code from the article"Dynamic Layout Algorithm to Display General Graphs"by Laszlo Szirmay-Kalos, szirmay@fsz.bme.huin "Graphics Gems IV", Academic Press, 1994Installation of the Dynamic Layout Program ( graph )====================================================This program can be installed under UNIX/X-WINDOW or underMS-WINDOWS environment.To install under UNIX/X-WINDOWS use the make utility, -----------------------------------------------------which generates the executable program called "graph" relying on the Makefile: make -f MakefileMakefile supposes: - gcc (gnu C++ compiler) - XLib header files in /usr/include/X11R4 - XLib library in /usr/lib/X11R4If your system has the XLib header files and libraries in differentlocations please modify the INCLUDES and LDFLAGS flags in theMakefile. Since the program has been written to meet the AT&T C++standard, even if you have a C++ compiler other than gcc, you canexpect to compile the program without difficulties after modifying theCC and CFLAGS. For the sake of maximum compatibility the program doesnot take advantage of advanced widget sets ( such as Motif ), neitherdoes it require color screen.To install under DOS/MS-WINDOWS 3.x , -----------------------------------------------------a UNIX shell script (mswin.gen) should be invoked first, which converts the file names according to the requirements of DOS and Borland C++ compiler. This shell script expects a directory as commandline argument and will place the generated file to the given directory: mswin.gen mswinwill generate the files in mswin directory. Having generated the files, they should to transferred to aDOS/MS-WINDOWS system and the make utility of the borland C++ 3.1compiler can be used to generate the executable file ( called graph ),which will run under MS-WINDOWS environment.The information file of the make is called graph.mak here, which supposes: - borland C++ compiler, version 3.1 Running the graph program:==========================Under UNIX/X-WINDOW the program can be started by typing "graph" with afile name argument referring to the definition of a graph: graph g20.datUnder DOS/MS-WINDOWS you should also start MS-WINDOWS as for example: win graph g20.dat Two sample files are included in this package: g.dat, g20.dat. In additionto that, you can also define graphs in the format described below.Having started the program, it will display the original arrangement ofthe graph on the screen, which can be altered by the layout algorithmby pressing the key <L>, or can be arranged randomly by pressing thekey <R>. Key <Q> gets the program to quit, while saving the lastarrangement in file ggg.dat.Files of the program=====================The complete file set consists of the following files:1. C++ Source files: layout.C = Dynamic layout and Initial Placement algorithms fileio.C = File I/O operations graph.C = Manipulation of Graph data structure and event handlers vector.C = 2D vector operations window.C = class library to interface XLib mswindow.C = class library to interface MS-WINDOWS 2. C++ Header files: defines.h fileio.hxx graph.hxx vector.hxx window.hxx mswindow.hxx3. README files: README = you are reading this file! 4. Program generation files: Makefile = makefile for X-WINDOWS graph.mak = makefile for MS-WINDOWS mswin.gen = UNIX shell script to generate dos file names: layout.C -> layout.cpp fileio.C -> fileio.cpp graph.C -> graph.cpp vector.C -> vector.cpp mswindow.C -> mswindow.cpp defines.h -> defines.h fileio.hxx -> fileio.hxx graph.hxx -> graph.hxx vector.hxx -> vector.hxx mswindow.hxx -> mswindow.hxx graph.mak -> graph.mak *.dat -> *.dat 5. Sample Data files for the definition of graphs g.dat g20.dat Definitions of graph description files======================================The layout program expects the input data in a text file and alsogenerates output file in the same format during the termination. Thisfile defines a weighted graph to be arranged in a easy-to-understand,programming language like way.The definition language consists ofkeywords: NAME, POSITION, TYPE, RELATIONS, OF, NODE, RELATION, RELATED, TO,-------- WITH, INTENSITY, END, MOVEABLE, FIXEDKeywords should be specified by capital letters.operators:--------- = : string variables:----------------- Any ASCII character string, having maximal length of 10 and which does not contain characters "= : # space tab newline"real variables:--------------- For positions the range (0..1000.0, 0..1000.0) is allowed and for weights (relation intensity) the range (-10.0..10.0) is permitted. comments:--------- The characters following a # character as far as the end of line are assumed to form a commentKeywords, variables and comments should be separated by whitespace characters(space, tabulator, newline) or operators.The basic structure of Graph definition File: node definition node definition . . . node definition node relation definition node relation definition . . . node relation definition node definition ( position is optional ): NAME = nodename [POSITION = position] TYPE = nodetype nodename: Any ASCII character string, having maximal length of 10 and which does not contain characters "= : # space newline". This name must be unique, that is only one node can have it. position: Two real values in the range of (0..1000.0) nodetype: FIXED or MOVEABLE node relation definition: RELATIONS OF nodename NODE relation definition relation definition . . . relation definition ENDnodename: Name of already declared node in node definition relation definition: RELATION relation : RELATED TO node WITH INTENSITY intensity relation: Any ASCII character string, having maximal length of 10 and which does not contain characters "= : # space newline" The name * means that no name is specified for this relation.node: Name of already declared node in node definitionintensity: A real value in the range of (-10.0 .. 10.0)A relation between two nodes can be defined in the file several times.In this case the last definition is taken into consideration.SAMPLE INPUT FILE-----------------## DEMO RELATION GROUP - I am a comment### DECLARATIONS OF NODES#NAME = n1 POSITION = 764.2 216.0 TYPE = FIXEDNAME = n2 POSITION = 131.3 858.6 TYPE = FIXEDNAME = n3 TYPE = MOVEABLE # POSITION = x,y is optionalNAME = n4 TYPE = MOVEABLENAME = n5 TYPE = MOVEABLENAME = n6 TYPE = MOVEABLENAME = n7 TYPE = MOVEABLENAME = n8 TYPE = MOVEABLENAME = n9 POSITION = 688.0 587.1 TYPE = MOVEABLE## DECLARATIONS OF RELATIONS#RELATIONS OF n1 NODERELATION r12 : RELATED TO n2 WITH INTENSITY 3.000000ENDRELATIONS OF n2 NODERELATION r23 : RELATED TO n3 WITH INTENSITY 2.000000 ENDRELATIONS OF n3 NODERELATION r31 : RELATED TO n1 WITH INTENSITY 6.000000ENDRELATIONS OF n4 NODERELATION r42 : RELATED TO n2 WITH INTENSITY 4.000000ENDRELATIONS OF n5 NODERELATION r53 : RELATED TO n3 WITH INTENSITY 3.000000## * relation name means no name#RELATION * : RELATED TO n8 WITH INTENSITY 3.000000ENDRELATIONS OF n7 NODE # empty relation is also allowedENDRELATIONS OF n9 NODE ## * relation name means no name#RELATION * : RELATED TO n8 WITH INTENSITY 3.000000END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -