cot 6936: topics in algorithmsgiri/teach/6936/s14/lecx-leda.pdfcot 6936: topics in algorithms giri...
TRANSCRIPT
![Page 1: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/1.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
COT 6936: Topics in Algorithms
Giri Narasimhan
ECS 254A / EC 2474; Phone x3748; Email: [email protected]
HOMEPAGE: http://www.cs.fiu.edu/~girihttps://moodle.cis.fiu.edu/v2.1/course/view.php?id=612
Mar 6, 2014
![Page 2: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/2.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Presentation Outline
1 LEDA: Library of Efficient Data Structures and Algorithms
2 Features of LEDA
3 Another LEDA Example
![Page 3: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/3.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 1 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉
2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 4: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/4.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 2 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;
3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 5: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/5.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 3 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])
4: {5: graph G;6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 6: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/6.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 4 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;
6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 7: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/7.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 5 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);
7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 8: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/8.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 6 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);7: G.read(filename);
8: cout � PLANAR(G) � endl;9: }
![Page 9: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/9.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 7 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 10: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/10.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Small Example
Algorithm 8 Planarity Testing
1: #include 〈LEDA/graph/graph alg.h〉2: using namespace leda;3: int main(int argc, char *argv[])4: {
5: graph G;6: string filename(argv[1]);7: G.read(filename);8: cout � PLANAR(G) � endl;
9: }
![Page 11: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/11.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Presentation Outline
1 LEDA: Library of Efficient Data Structures and Algorithms
2 Features of LEDA
3 Another LEDA Example
![Page 12: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/12.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview
A C++ library of data structures and algorithms
Efficient code
Amply tested
Extensively documented
Widely installed
![Page 13: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/13.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview
Basic Data Types float, bigfloat, rational, real, list, map,queue, stack, array, vector, set, matrix, polynomials,string, . . .
More Data Types trees, balanced trees, priority queues,heaps, binomial heaps, Fibonacci heaps, dictionary, hashtable, string, tuple, . . .
Basic Algorithms Sorting, Searching, Hashing, alignment,partition, . . .
Graph Algorithms BFS, DFS, MST, Dijkstra,Floyd-Warshall, maxflow, mincut, matching, isomorphism,markov chain, planar graphs, planarity testing, graphdrawing algorithms, triangulations, . . .
![Page 14: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/14.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview
Basic Data Types float, bigfloat, rational, real, list, map,queue, stack, array, vector, set, matrix, polynomials,string, . . .
More Data Types trees, balanced trees, priority queues,heaps, binomial heaps, Fibonacci heaps, dictionary, hashtable, string, tuple, . . .
Basic Algorithms Sorting, Searching, Hashing, alignment,partition, . . .
Graph Algorithms BFS, DFS, MST, Dijkstra,Floyd-Warshall, maxflow, mincut, matching, isomorphism,markov chain, planar graphs, planarity testing, graphdrawing algorithms, triangulations, . . .
![Page 15: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/15.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview
Basic Data Types float, bigfloat, rational, real, list, map,queue, stack, array, vector, set, matrix, polynomials,string, . . .
More Data Types trees, balanced trees, priority queues,heaps, binomial heaps, Fibonacci heaps, dictionary, hashtable, string, tuple, . . .
Basic Algorithms Sorting, Searching, Hashing, alignment,partition, . . .
Graph Algorithms BFS, DFS, MST, Dijkstra,Floyd-Warshall, maxflow, mincut, matching, isomorphism,markov chain, planar graphs, planarity testing, graphdrawing algorithms, triangulations, . . .
![Page 16: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/16.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview
Basic Data Types float, bigfloat, rational, real, list, map,queue, stack, array, vector, set, matrix, polynomials,string, . . .
More Data Types trees, balanced trees, priority queues,heaps, binomial heaps, Fibonacci heaps, dictionary, hashtable, string, tuple, . . .
Basic Algorithms Sorting, Searching, Hashing, alignment,partition, . . .
Graph Algorithms BFS, DFS, MST, Dijkstra,Floyd-Warshall, maxflow, mincut, matching, isomorphism,markov chain, planar graphs, planarity testing, graphdrawing algorithms, triangulations, . . .
![Page 17: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/17.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Geometric Data Structures and Algorithms point, line,ray, segment, polygon, circle, plane, rectangles, triangle,hull, plane sweep, delaunay trinagulations, Voronoidiagrams, range trees, interval trees, kd-trees, pointlocations, segment trees, transformations, . . .
Linear Algebra modular arithmetic, long integers, numbertheory algorithms, . . .
Graph Types and Operations undirected, directed,weighted, planar, adding/removing edges/vertices, faces,. . .
GRAPH〈vtype, etype〉:Graphics windows, colors, scenes, panels, menu, pixmaps,bitmaps, . . .
graph-windows:
![Page 18: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/18.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Geometric Data Structures and Algorithms point, line,ray, segment, polygon, circle, plane, rectangles, triangle,hull, plane sweep, delaunay trinagulations, Voronoidiagrams, range trees, interval trees, kd-trees, pointlocations, segment trees, transformations, . . .
Linear Algebra modular arithmetic, long integers, numbertheory algorithms, . . .
Graph Types and Operations undirected, directed,weighted, planar, adding/removing edges/vertices, faces,. . .
GRAPH〈vtype, etype〉:Graphics windows, colors, scenes, panels, menu, pixmaps,bitmaps, . . .
graph-windows:
![Page 19: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/19.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Geometric Data Structures and Algorithms point, line,ray, segment, polygon, circle, plane, rectangles, triangle,hull, plane sweep, delaunay trinagulations, Voronoidiagrams, range trees, interval trees, kd-trees, pointlocations, segment trees, transformations, . . .
Linear Algebra modular arithmetic, long integers, numbertheory algorithms, . . .
Graph Types and Operations undirected, directed,weighted, planar, adding/removing edges/vertices, faces,. . .
GRAPH〈vtype, etype〉:Graphics windows, colors, scenes, panels, menu, pixmaps,bitmaps, . . .
graph-windows:
![Page 20: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/20.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Geometric Data Structures and Algorithms point, line,ray, segment, polygon, circle, plane, rectangles, triangle,hull, plane sweep, delaunay trinagulations, Voronoidiagrams, range trees, interval trees, kd-trees, pointlocations, segment trees, transformations, . . .
Linear Algebra modular arithmetic, long integers, numbertheory algorithms, . . .
Graph Types and Operations undirected, directed,weighted, planar, adding/removing edges/vertices, faces,. . .
GRAPH〈vtype, etype〉:Graphics windows, colors, scenes, panels, menu, pixmaps,bitmaps, . . .
graph-windows:
![Page 21: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/21.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Geometric Data Structures and Algorithms point, line,ray, segment, polygon, circle, plane, rectangles, triangle,hull, plane sweep, delaunay trinagulations, Voronoidiagrams, range trees, interval trees, kd-trees, pointlocations, segment trees, transformations, . . .
Linear Algebra modular arithmetic, long integers, numbertheory algorithms, . . .
Graph Types and Operations undirected, directed,weighted, planar, adding/removing edges/vertices, faces,. . .
GRAPH〈vtype, etype〉:Graphics windows, colors, scenes, panels, menu, pixmaps,bitmaps, . . .
graph-windows:
![Page 22: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/22.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Control Structuresforall nodes(v ,G )
forall edges(e,G )forall adj nodes(v ,w)forall adj edges(e,w)forall out edges(e,w)forall in edges(e,w)
![Page 23: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/23.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Control Structuresforall nodes(v ,G )forall edges(e,G )
forall adj nodes(v ,w)forall adj edges(e,w)forall out edges(e,w)forall in edges(e,w)
![Page 24: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/24.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Control Structuresforall nodes(v ,G )forall edges(e,G )forall adj nodes(v ,w)forall adj edges(e,w)
forall out edges(e,w)forall in edges(e,w)
![Page 25: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/25.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Control Structuresforall nodes(v ,G )forall edges(e,G )forall adj nodes(v ,w)forall adj edges(e,w)forall out edges(e,w)forall in edges(e,w)
![Page 26: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/26.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Overview Cont’d
Control Structuresforall nodes(v ,G )forall edges(e,G )forall adj nodes(v ,w)forall adj edges(e,w)forall out edges(e,w)forall in edges(e,w)
![Page 27: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/27.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Presentation Outline
1 LEDA: Library of Efficient Data Structures and Algorithms
2 Features of LEDA
3 Another LEDA Example
![Page 28: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/28.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Example
Algorithm 9 Planarity Testing
#include 〈LEDA/graph/graph alg.h〉using namespace leda;int main(int argc, char *argv[]){
graph G;string filename(argv[1]); G.read(filename);list〈edge〉 edge list;
if (PLANAR(G, edge list) == 0)forall (x ,edge list) G.print edge(x);
}
![Page 29: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/29.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Example
Algorithm 10 Planarity Testing
#include 〈LEDA/graph/graph alg.h〉using namespace leda;int main(int argc, char *argv[]){
graph G;string filename(argv[1]); G.read(filename);list〈edge〉 edge list;if (PLANAR(G, edge list) == 0)
forall (x ,edge list) G.print edge(x);}
![Page 30: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/30.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Example
Algorithm 11 Planarity Testing
#include 〈LEDA/graph/graph alg.h〉using namespace leda;int main(int argc, char *argv[]){
graph G;string filename(argv[1]); G.read(filename);list〈edge〉 edge list;if (PLANAR(G, edge list) == 0)forall (x ,edge list) G.print edge(x);
}
![Page 31: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/31.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
LEDA Example
Algorithm 12 Planarity Testing
#include 〈LEDA/graph/graph alg.h〉using namespace leda;int main(int argc, char *argv[]){
graph G;string filename(argv[1]); G.read(filename);list〈edge〉 edge list;if (PLANAR(G, edge list) == 0)forall (x ,edge list) G.print edge(x);
}
![Page 32: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/32.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Sample LEDA Figures
![Page 33: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/33.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )
Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 34: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/34.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 35: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/35.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 36: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/36.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.
Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 37: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/37.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl.
For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 38: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/38.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 39: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/39.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries
as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 40: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/40.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 41: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/41.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.
![Page 42: COT 6936: Topics in Algorithmsgiri/teach/6936/S14/LecX-leda.pdfCOT 6936: Topics in Algorithms Giri Narasimhan LEDA: Library of E cient Data Structures and Algorithms Features of LEDA](https://reader033.vdocuments.site/reader033/viewer/2022042010/5e71a532e37525378010ce58/html5/thumbnails/42.jpg)
COT 6936:Topics in
Algorithms
GiriNarasimhan
LEDA: Libraryof EfficientDataStructures andAlgorithms
Features ofLEDA
Another LEDAExample
Running LEDA
You can run it on any of the unix-based machines in SCIS(e.g., jaguar, ermine, stoat, . . . )Modify .cshrc (or other shell startup config file):alias add2path ’if ("$path:q" ! *"$"* ) set path=( $path $ )’
setenv LEDAROOT /depot/LEDA-6
add2path $LEDAROOT/Manual/cmd
setenv LEDA $LEDAROOT/incl/LEDA
and add $LEDAROOT to the env variable LD LIBRARY PATH
Next, either login again or type source .cshrc to forcethe shell to read the changes to the config file.Compile the .c file using the include flags$LEDAROOT/incl. For e.g.,g++ -O3 -I$LEDAROOT/incl -c test.c
Link and load and create executable using appropriateflags to load libraries as shown belowg++ -I$LEDAROOT/incl -o test test.o -L$(LEDAROOT) -lleda -lm -lX11
Finally you are ready to execute the executable test
Sample Makefile available on your class moodle site.