FAQ
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 18k
Development Platform:

MultiPlatform

  1.                         The  Leda FAQ File
  2. ------------------
  3. ------------------
  4. This is the monthly posting of the Frequently Asked Questions about
  5. LEDA and the `comp.lang.c++.leda' newsgroup.
  6. Newsgroup: comp.lang.c++.leda
  7. Date: 07/07/95
  8. Number: 4
  9. Contents
  10. --------
  11.    I) Introduction
  12.     1. What is LEDA?
  13.     2. From where can i get information about LEDA?
  14.     3. How can i get LEDA?
  15.   ! 4. What is the current version of LEDA?
  16.   II) Bugs
  17.    
  18.     1. What can i do if i find a bug?
  19.     2. Where can i find information about bugs and fixes?
  20.  III) Platforms
  21.  
  22.   ? 1. On what platforms and with which compilers can LEDA be used?
  23.     2. Can LEDA be used with other programming languages? 
  24.     3. Will LEDA take care of name conflicts with other packages?
  25.     4. Is there still a non-template version of LEDA available?
  26.     5. Why does LEDA not use standard templates to realize parameterized
  27.        data types?
  28.     6. Is an on-line user manual available?
  29.     7. The manual seems to be typeset for european paper size (A4)
  30.        how can I print it on the standard us paper?
  31.     8. Where can I read more about the internals (e.g. realization of
  32.        parameterized data types)?
  33.  
  34.   IV) Basics
  35.     1. How do I delete entries in a d_array?
  36.     2. Why are modifications in forall-loops not allowed ?
  37.     3. Are preconditions checked or not (is there a way to control this)
  38.     4. What is the LEDA item concept?
  39.     5. Does LEDA support persistent data structures
  40.  
  41.    V) Graphs
  42.     1. Why does LEDA complain when i try to insert an edge between two
  43.        nodes of a graph G into a copy of graph G?
  44.     2. There seems to be a subgraph type, however, it is not mentioned 
  45.        in the manual?
  46.     3. Node and edge arrays work only for static graphs, what do I 
  47.        do if the node/edge set changes dynamically?
  48.   ! 4. What graph/network algorithms are available in LEDA?
  49.     5. Can I derive my own node/edge type from the LEDA type "node" 
  50.        ("edge")?
  51.     6. How can I search for a particular edge (v,w) in a Graph?
  52.  
  53.   VI) GRAPHICS
  54.     1. Does the LEDA graphics work on platforms other than X11?
  55.  VII) Geometry
  56.     1. Will there be three-dimensional geometry?
  57. VIII) Problems
  58.   ! 1. What does it mean if i get a runtime error : "compare undefined" 
  59.        or"Hash undefined"?
  60.   ! 2. Why does the compiler instantiate the predefined function
  61.        template compare (Hash) although i have defined my own?
  62.   ! 3. Why do i get the runtime error "compare undefined" when calling
  63.        the list::search function.
  64.     4. What does it mean if the compiler complains about the functions
  65.        Clear, Convert and Copy?
  66.   + 5. Why does the g++ 2.7.0 compiler complain about undefined integer 
  67.        variables in old programs that did work with the previous 
  68.        compiler version (or when compiling an old LEDA version)?
  69. IX) General questions
  70.     1. What is the run time/space overhead compared to programs written 
  71.        in C?
  72.   +: new item
  73.   !: changed
  74.   ?: additional information would be appreciated
  75. -----------------------------------------------------------------------
  76. -----------------------------------------------------------------------
  77. I) Introduction
  78. ---------------
  79. 1. What is LEDA?
  80.                                   LEDA
  81.              A Library of Efficient Data Types and Algorithms
  82.                    Max-Planck-Institut fuer Informatik
  83.                Im Stadtwald, D-66123 Saarbruecken, Germany   
  84.                         (leda@mpi-sb.mpg.de)
  85.   
  86. LEDA is a library of the data types and algorithms of combinatorial
  87. computing. 
  88. The main features are:
  89. 1)  LEDA provides a sizable collection of data types and algorithms in a
  90.     form which allows them to be used by non-experts. In the current 
  91.     version, this collection includes most of the data types and 
  92.     algorithms described in the text books of the area.  
  93.     
  94. 2)  LEDA gives a precise and readable specification for each of the data
  95.     types and algorithms mentioned above.  The specifications are short 
  96.     (typically not more than a page), general (so as to allow several 
  97.     implementations), and abstract (so as to hide all details of the 
  98.     implementation). 
  99. 3)  For many efficient data structures access by position is important. 
  100.     In LEDA, we use an item concept to cast positions into an abstract 
  101.     form. We mention that most of the specifications given in the LEDA 
  102.     manual use this concept, i.e., the concept is adequate for the 
  103.     description of many data types.
  104.     
  105. 4)  LEDA contains efficient implementations for each of the data types, 
  106.     e.g., Fibonacci heaps for priority queues, red-black trees and 
  107.     dynamic perfect hashing for dictionaries, ...
  108. 5)  LEDA contains a comfortable data type graph. It offers the standard 
  109.     iterations such as ``for all nodes v of a graph G do'' or ``for all 
  110.     neighbors w of v do'', it allows to add and delete vertices and  
  111.     edges and it offers arrays and matrices indexed by nodes and edges,
  112.     ... The data type graph allows to write programs for graph problems 
  113.     in a form close to the typical text book presentation.
  114. 6)  LEDA is implemented by a C++ class library. It can be used with 
  115.     many C++ compilers (cfront2.1, cfront3.0, g++, SunPro ...).
  116. 7)  LEDA is not in the public domain, but can be used freely for 
  117.     academic research and teaching (this does not include research
  118.     within a company or state/government departement).
  119.     For information concerning a commercial license please contact
  120.     leda@mpi-sb.mpg.de.
  121. 2. From where can i get information about LEDA?
  122. World Wide Web:
  123.             http://www.mpi-sb.mpg.de/LEDA/leda.html
  124. anonymous ftp:
  125.             ftp.mpi-sb.mpg.de    in   pub/LEDA
  126. email:      leda@mpi-sb.mpg.de
  127. Fax:        +49 681 / 302 5401
  128. Phone:      +49 681 / 302 5354
  129. Address:
  130.             Christian Uhrig
  131.             Max-Planck-Institut fuer Informatik
  132.             Im Stadtwald
  133.             66123 Saarbruecken
  134.             Germany
  135. 3. How can i get LEDA?
  136. The LEDA version for academic research is available
  137. by anonymous ftp from 
  138.     ftp.mpi-sb.mpg.de        pub/LEDA
  139. or via WWW from
  140.     http://www.mpi-sb.mpg.de/LEDA/leda.html
  141. 4. What is the current version of LEDA?
  142. The current version of LEDA is LEDA-R 3.2.
  143. The version LEDA 3.2 is the commercial version.
  144. -----------------------------------------------------------------------
  145. -----------------------------------------------------------------------
  146. II) Bugs
  147. --------
  148. 1. What can i do if i find a bug.
  149. Send an email to leda@mpi-sb.mpg.de. This email should contain
  150. a) the platform you`re using (machine, operating system + version, 
  151. compiler + version)
  152. b) a description of the problem (for instance compiler messages)
  153. c) a short example program (with description what it is supposed to do,
  154. please).
  155. 2. Where can i find information about bugs and fixes?
  156. On the directory pub/LEDA at ftp.mpi-sb.mpg.de there is a file
  157.   BUGS-x.x.x 
  158. where x.x.x is the current version number. In this file
  159. the known Bugs of the current version are listed together with the
  160. fixes (if known).
  161. From time to time the LEDA version is replaced by a new one where the
  162. fixes are incorporated. Then the BUGS file is cleared and a
  163. diff file is made available.
  164. -----------------------------------------------------------------------
  165. -----------------------------------------------------------------------
  166. III) Platforms (Operating Systems, Compilers, ...)
  167. --------------------------------------------------
  168. 1. On what platforms and with which compilers can LEDA be used?
  169.  
  170. We tested it with
  171. SunOs 4.1.3                     g++, AT&T cfront, SunPro 4.0.1, lcc 3.1
  172. Solaris                         g++, SunPro 4.0.1, lcc 3.1
  173. IBM                             xlC (CSet++, Aix)
  174. Linux                           g++
  175. SGI                             SGI CC, g++
  176. Dos                             Watcom 10.0, Borland 4.5, Zortech 3.1, emx
  177. Other people use it with
  178. several HP machines             HP-UX C++, g++
  179. Dec Alpha                       Dec C++, gcc, cxx
  180. We would like to know 
  181. - whether there are more platforms where LEDA is in use
  182. - which problems did arise there
  183. - which modification had to be made 
  184. Thank you very much.
  185. 2. Can LEDA be used with other programming languages?  
  186. No. LEDA only works with C++.
  187. 3. Will LEDA take care of name conflicts with other packages?
  188. Currently not, but it is planned to use c++ name spaces.
  189. 4. Is there still a non-template version of LEDA available?
  190. No.
  191. 5. Why does LEDA not use standard templates to realize parameterized
  192.    data types?
  193. LEDA uses templates only on the top most level to derive a parameterized
  194. data type from the implementation class. Thus the convenience of 
  195. templates is saved. Using C++ templates on each level has the effect
  196. that a large amount of code has to be (re)compiled when
  197. instantiating a parameterized data type, e.g., dictionary<K,I> D
  198. would cause a re-compilation of the underlying data structure
  199. (e.g. skiplist) with actual key parameter K and information parameter I.
  200. When using several instances of the same data types with different 
  201. actual type parameters this leads also to code duplication. LEDA
  202. tries to encapsulate those parts of the code that depend on the
  203. type parameters in small (inlined) virtual functions (e.g. the
  204. cmp_key function for dictionaries). Then only these small parts
  205. have to be recompiled. Most of the code is type-independent and
  206. is never looked at by the compiler when compiling an application
  207. program. This is achieved by internally using (generic) pointers to 
  208. the data to be stored in container types. Details of the implementation 
  209. will be described in the LEDA book that will appear at the end of 1995.
  210. 6. Is an on-line user manual available?
  211.  
  212. Yes. There is a command "tman" which gives you the contents of the
  213. manual pages for the type "typename" which is given as argument. 
  214. Example:   tman array 
  215. 7. The manual seems to be typeset for european paper size (A4)
  216.    how can I print it on the standard us paper?
  217. You have to change the parameters in the beginning of the
  218. MANUAL.mac file.
  219. 8. Where can I read more about the internals (e.g. realization of
  220.    parameterized data types)?
  221. Kurt Mehlhorn and Stefan N"aher are writing a book that will appear
  222. in the second half of the year and contains many details about
  223. the realization of LEDA.
  224. -----------------------------------------------------------------------
  225. -----------------------------------------------------------------------
  226. IV) Basics
  227. ---------
  228. 1. How do I delete entries in a d_array?
  229. In the current version deletion of entries in d_arrays is not supported
  230. but will be the next version.
  231. 2. Why are modifications in forall-loops not allowed ?
  232. A forall-statement should iterate over all elements contained in a  
  233. collection at the time of the beginning of the iteration.  This, however
  234. is hard to implement or very costly if the contents of the collection is
  235. allowed to be changed inside the body of the loop. Therefore, we decided
  236. not to allow it. This condition is not checked (would be too expensive) 
  237. and  this causes some problems. A typical problem occurs if you want to 
  238. make a graph bidirected by inserting a reverse edge for every edge of 
  239. the graph. The following piece
  240. of code will cause an endless loop
  241. forall_edges(e,G) G.new_edge(target(e),source(e));
  242. Two possible ways of doing it right
  243.  i) make a copy (expensive)
  244.     list<edge> L = G.all_edges();
  245.     forall(e,L) G.new_edge(target(e),source(e));
  246. ii) implement iteration with G.first_edge(),G.last_edge(), and  G.succ_edge() 
  247.     edge last_e = G.last_edge();
  248.     for(e=G.first_edge(); e!=last_e; e = G.succ_edge(e) ) G.new_edge ...
  249.     if (last_e) G.new_edge(target(last_e),source(last_e));
  250. A similar proble can arise if you delete the current element in an
  251. iteration loop from its collection.
  252. 3. Are preconditions checked or not (is there a way to control this)
  253. Currently only a few preconditions are checked. In the future it there
  254. will be two classes of preconditions. Class 1 will be always checked.
  255. The checking of class 2 will be controlled by a compiler option.
  256. 4. What is the LEDA item concept?
  257. The item concept in LEDA allows access by position in a clean and controlled
  258. way. All container data types are defined as collection of certain items.
  259. These items are created by insert operations and can be returned by access
  260. operations (e.g. lookup). This enables the application program to access
  261. the information associated the the item directly and in constant time without
  262. any search operation beeing involved. This access, however, is restricted.
  263. For instance, you can change the information of a dictionary item by a 
  264. change_inf operation, but there is no way to change its key - because
  265. this would corrupt the underlying data structure. See the LEDA manual, 
  266. for a detailed description and for examples.
  267. 5. Does LEDA support persistent data structures
  268. In the current version LEDA does not support persistency. However,
  269. it is possible, to save and restore the contents of many data types
  270. (e.g. graphs) by special read/write functions.
  271. -----------------------------------------------------------------------
  272. -----------------------------------------------------------------------
  273. V) Graphs
  274. ---------
  275. 1. Why does LEDA complain when i try to insert an edge between two
  276.    nodes of a graph G into a copy of graph G?
  277. Each copy of a graph has its own set ofnodes and each node does belong 
  278. to at most one graph. Thus one has to insert the edge between the copies
  279. of the nodes.
  280. 2. There seems to be a subgraph type, however, it is not mentioned in the manual?
  281. Subgraphs are experimental at the moment, they will be fully implemented
  282. in the future.
  283. 3. Node and edge arrays work only for static graphs, what do I do if the node/edge
  284. set changes dynamically.
  285. Use node_map/edge_map instead.
  286. 4. What graph/network algorithms are available in LEDA
  287. The following is the list of the algorithms. See the manual for the
  288. names of the procedures.
  289. All pairs shortest paths.
  290. Bellman Ford algorithm.
  291. Breadth first search.
  292. Connected Components.
  293. Depth first search.
  294. Dijkstra's algorithm.
  295. Maximal cardinality matching.
  296. Maximal cardinality bipartite matching.
  297. ! Minimum cut.
  298. Maximum flow algorithm.
  299. Maximum weighted bibartite matching.
  300. ! Maximum weighted matching.
  301. Minimum spanning tree.
  302. Planarity test.
  303. Spanning tree.
  304. Straight line embedding of planar graphs.
  305. Strongly connected components.
  306. Topological sorting.
  307. Transitive closure of graphs.
  308. Triangulating planar maps.
  309. 5. Can I derive my own node/edge type from the LEDA type "node" ("edge")?
  310. No, node and edge are item types (implemented by pointers).
  311. 6. How can I search for a particular edge (v,w) in a Graph?
  312. This operation is not supported efficiently at the moment, you can use
  313. a node_matrix with n^2 space; it will be implemented by two-dimensionl
  314. maps in the future.
  315. -----------------------------------------------------------------------
  316. -----------------------------------------------------------------------
  317. VI) GRAPHICS
  318. ------------
  319. 1. Does the LEDA graphics work on platforms other than X11?
  320. There are planned commercial version that work on MS-DOS, OS2
  321. and Windows.
  322. -----------------------------------------------------------------------
  323. -----------------------------------------------------------------------
  324. VII) Geometry
  325. -------------
  326. 1. Will there be three-dimensional geometry?
  327. Yes. In future versions  there at least will be
  328. three-dimensional basic objects like points, segments, lines, ...
  329. -----------------------------------------------------------------------
  330. -----------------------------------------------------------------------
  331. VIII) Problems
  332. -------------
  333. 1. What does it mean if i get a runtime error: "compare undefined" or
  334.    "Hash undefined"?
  335. If you use a class as type parameter than several parameterized types
  336. require a linearly ordered subtype
  337. (i.e. dictionary, sorted sequence, priority queue) 
  338. or a hashed type (i.e. dictionary with hashing implementation, hashing
  339. arrays). These functions are predefined for simple data types (char,
  340. short, int, long, float, double, string, point) and pointer types. 
  341. For all other types
  342. in case that compare is called, a function template compare (hash) is 
  343. instantiated that stops the program with the error message above, 
  344. telling you that you have to define a function 
  345.             int compare(const T&, const T&)
  346. resp.
  347.             int Hash(const T&)
  348. for the parameter type T.
  349. 2. Why does the compiler instantiate the predefined function template 
  350.    compare (Hash) although i have defined my own.
  351. With high probability you're using g++ 2.6.3. This version cannot
  352. handle specialications of function templates correctly. It usually
  353. helps to declare the compare (hash) function inline.
  354. 3. Why do i get the runtime error "compare undefined" when calling
  355.    the list::search function.
  356. The search function for lists
  357. is realized using of the compare function if the parameter type
  358. (which has to be defined
  359. for list parameters since the list::sort() function is available).
  360. 4. What does it mean if the compiler complains about the functions
  361.    Clear, Convert and Copy?
  362. These functions are necessary when using a data type as parameter
  363. of some class type.
  364. Maybe you're using g++ versions older than 2.5.8. For later compiler
  365. versions the functions mentioned above are generated automatically.
  366. If not, you should call a macro
  367.               LEDA_TYPE_PARAMETER(typename)
  368. immediately after the definition of class typename. We suggest of course
  369. to upgrade the compiler version.
  370. 5. Why does the g++ 2.7.0 compiler complain about undefined integer 
  371.    variables in old programs that did work with the previous 
  372.    compiler version (or when compiling an old LEDA version)?
  373. The scope of a variable defined in a for statement
  374. for (int i = 0; i < 10; i++);
  375. from now on is restricted to the loop body. g++ 2.7.0 follows that
  376. rule.
  377. -----------------------------------------------------------------------
  378. -----------------------------------------------------------------------
  379. IX) General questions
  380. ---------------------
  381. 1. What is the run time/space overhead compared to programs written in 
  382.    C?
  383. Dr. Ulrich Lauther from the Siemens AG made a couple of experiemts and
  384. compared LEDA graph algorithms with his own hand-coded and well-tuned 
  385. C-programs. The running time of LEDA programs are typically slower by a 
  386. factor between 2 and 5. The space requirement of the LEDA graph data s
  387. structures is larger by a factor of about 2.