graph_alg.h
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:21k
开发平台:

MultiPlatform

  1. /*******************************************************************************
  2. +
  3. +  LEDA-R  3.2.3
  4. +
  5. +  graph_alg.h
  6. +
  7. +  Copyright (c) 1995  by  Max-Planck-Institut fuer Informatik
  8. +  Im Stadtwald, 66123 Saarbruecken, Germany     
  9. +  All rights reserved.
  10. *******************************************************************************/
  11. #ifndef LEDA_GRAPHALG_H
  12. #define LEDA_GRAPHALG_H
  13. #include <LEDA/graph.h>
  14. #include <LEDA/node_matrix.h>
  15. /*{Manpage {graph_alg} {} {Graph Algorithms}}*/
  16. /*{Mtext
  17. bigskip
  18. This section gives a summary of the graph algorithms contained in LEDA.
  19. All algorithms are generic, i.e., they accept instances of any user defined
  20. parameterized graph type $GRAPH${tt <}$vtype,etype${tt >} as arguments.
  21. The header file {tt <}LEDA/graph_alg.h{tt >} has to be included.
  22. }*/
  23. //-----------------------------------------------------------------------------
  24. // basic graph algorithms:
  25. //-----------------------------------------------------------------------------
  26. /*{Mtext
  27. bigskip
  28. subsection{Basic Algorithms}
  29. label{Basic Algorithms}
  30. }*/
  31. bool        TOPSORT(const graph& G, node_array<int>& ord);
  32. /*{Mtext
  33. $bullet$ {bf Topological Sorting}
  34. medskip
  35. $bool$ TOPSORT($graph& G, node_array<int>& ord$)
  36. medskip
  37. TOPSORT takes as argument a directed graph $G(V,E)$. It sorts $G$ topologically 
  38. (if $G$ is acyclic) by computing for every node $v in V$ an integer $ord[v]$ 
  39. such that $1le ord[v]le |V|$ and $ord[v] < ord[w]$ for all edges 
  40. $(v,w) in E$. TOPSORT returns true if $G$ is acyclic and false otherwise.
  41. The algorithm (cite{Ka62}) has running time $O(|V|+|E|)$.
  42. }*/
  43. bool        TOPSORT1(graph& G);
  44. /*{Mtext
  45. medskip
  46. $bullet$ {bf Depth First Search}
  47. }*/
  48. list<node>  DFS(const graph& G, node s, node_array<bool>& reached) ;
  49. /*{Mtext
  50. $list<node>$  DFS($graph& G, node s, 
  51. node_array<bool>& reached$)
  52. medskip
  53. DFS takes as argument a directed graph $G(V,E)$, a node $s$ of $G$ and a 
  54. node_array $reached$ of boolean values. It performs a depth first search 
  55. starting at $s$ visiting all reachable nodes $v$ with $reached[v]$ = false. 
  56. For every visited node $v$ $reached[v]$ is changed to true. DFS returns the 
  57. list of all reached nodes.
  58. The algorithm (cite{T72}) has running time $O(|V|+|E|)$.
  59. }*/
  60. list<edge>  DFS_NUM(const graph& G, node_array<int>& dfsnum,
  61.                                     node_array<int>& compnum);
  62. /*{Mtext
  63. bigskip
  64. $list<edge>$  
  65. parbox[t]{12.5cm}{DFS_NUM($graph& G, node_array<int>&  
  66. dfsnum, node_array<int>&$ $compnum$)}
  67. medskip
  68. DFS_NUM takes as argument a directed graph $G(V,E)$. It performs a 
  69. depth first search of $G$ numbering the nodes of $G$ in two different ways. 
  70. $dfsnum$ is a numbering with respect to the calling time and $compnum$ a 
  71. numbering with respect to the completion time of the recursive calls. DFS_NUM 
  72. returns a depth first search forest of $G$ (list of tree edges).
  73. The algorithm (cite{T72}) has running time $O(|V|+|E|)$.
  74.  }*/
  75. list<node>  BFS(const graph& G, node s, node_array<int>& dist);
  76. /*{Mtext
  77. bigskip
  78. $bullet$ {bf Breadth First Search}
  79. medskip
  80. $list<node>$
  81. BFS($graph& G, node s, node_array<int>& dist$)
  82. medskip
  83. BFS takes as argument a directed graph $G(V,E)$ and a node $s$ of $G$. It 
  84. performs a breadth first search starting at $s$ computing for every visited 
  85. node $v$ the distance $dist[v]$ from $s$ to $v$. BFS returns the list of all 
  86. reached nodes.
  87. The algorithm (cite{M84}) has running time $O(|V|+|E|)$.
  88. }*/
  89. /*{Mtext
  90. bigskip
  91. $bullet$ {bf Connected Components}
  92. }*/
  93. int         COMPONENTS(const graph& G, node_array<int>& compnum);
  94. /*{Mtext
  95. $int$   COMPONENTS($graph& G, node_array<int>& compnum$)
  96. medskip
  97. COMPONENTS takes a graph $G(V,E)$ as argument and computes the connected
  98. components of the underlying undirected graph, i.e., for every node $vin V$ 
  99. an integer $compnum[v]$ from $[0dots c-1]$ where $c$ is the number of 
  100. connected components of $G$ and $v$ belongs to the $i$-th connected 
  101. component iff $compnum[v] = i$.  COMPONENTS returns $c$.
  102. The algorithm (cite{M84}) has running time $O(|V|+|E|)$.
  103. }*/
  104. int         COMPONENTS1(const graph& G, node_array<int>& compnum);
  105. int         STRONG_COMPONENTS(const graph& G, node_array<int>& compnum);
  106. /*{Mtext
  107. bigskip
  108. $bullet$ {bf Strong Connected Components}
  109. medskip
  110. $int$   STRONG_COMPONENTS($graph& G, node_array<int>& compnum
  111. $)
  112. medskip
  113. STRONG_COMPONENTS takes a directed graph $G(V,E)$ as argument and computes for 
  114. every node $vin V$ an integer $compnum[v]$ from $[0dots c-1]$ where
  115. $c$ is the number of strongly connected components of $G$ and
  116. $v$ belongs to the $i$-th strongly connected component iff $compnum[v] = i$.
  117. STRONG_COMPONENTS returns $c$.
  118. The algorithm (cite{M84}) has running time $O(|V|+|E|)$.
  119. }*/
  120. int         STRONG_COMPONENTS1(const graph& G, node_array<int>& compnum);
  121. int         BICONNECTED_COMPONENTS(const graph& G, edge_array<int>& compnum);
  122. /*{Mtext
  123. bigskip
  124. $bullet$ {bf Transitive Closure}
  125. }*/
  126. graph       TRANSITIVE_CLOSURE(const graph& G);
  127. /*{Mtext
  128. $graph$ TRANSITIVE_CLOSURE($graph& G$)
  129. medskip
  130. TRANSITIVE_CLOSURE takes a directed graph $G(V,E)$ as argument and computes 
  131. the transitive closure of $G(V,E)$. It returns a directed graph $G'(V',E')$ 
  132. with $V' = V$ and $(v,w) in E'  Leftrightarrow$ there is a path form
  133. $v$ to $w$ in $G$.
  134. The algorithm (cite{GK79}) has running time $O(|V|cdot |E|)$.
  135. }*/
  136. /*{Mtext
  137. subsection{Network Algorithms}
  138. label{Network Algorithms}
  139. Most of the following network algorithms are overloaded. They work
  140. for both integer and real valued edge costs.
  141. }*/
  142. //-----------------------------------------------------------------------------
  143. // shortest paths:
  144. //-----------------------------------------------------------------------------
  145. /*{Mtext
  146. bigskip
  147. $bullet$ {bf Single Source Shortest Paths }
  148. }*/
  149. void DIJKSTRA(const graph& G, node s, const edge_array<int>& cost, 
  150.                                             node_array<int>& dist, 
  151.                                             node_array<edge>& pred);
  152. /*{Mtext
  153. $void$ 
  154. parbox[t]{14cm}{DIJKSTRA($graph& G, node s$, $edge_array<int>$ $cost$,
  155.                  $node_array<int>$ $dist$,
  156.  $node_array<edge>$ $pred$)}
  157. smallskip
  158. $void$ 
  159. parbox[t]{14.5cm}{DIJKSTRA($graph& G, node s$, $edge_array<double>$ $cost$,
  160.                   $node_array<double>$ $dist$,
  161.                   $node_array<edge>$  $pred$)}
  162. medskip
  163. DIJKSTRA takes as arguments a directed graph $G(V,E)$, a source node $s$ and an 
  164. edge_array $cost$ giving for each edge in $G$ a non-negative cost. It 
  165. computes for each node $v$ in $G$ the distance $dist[v]$ from $s$ (cost of the 
  166. least cost path from $s$ to $v$) and the predecessor edge $pred[v]$ in the 
  167. shortest path tree.
  168. The algorithm (cite{Di59}, cite{FT87}) has running time $O(|E|+|V|log |V|)$.
  169. }*/
  170. bool BELLMAN_FORD(const graph& G, node s, const edge_array<int>& cost,
  171.                                                 node_array<int>& dist,
  172.                                                 node_array<edge>& pred);
  173. /*{Mtext
  174. bigskip
  175. $bool$ 
  176. parbox[t]{13.5cm}{BELLMAN_FORD($graph& G, node s$, 
  177.                  $edge_array<int>$ $cost$,
  178.  $node_array<int>$ $dist$,
  179.  $node_array<int>$ $pred$)}
  180. smallskip
  181. $bool$ 
  182. parbox[t]{12cm}{BELLMAN_FORD($graph& G, node s$, 
  183.                 $edge_array<double>$ $cost$,
  184. $node_array<double>$ $dist$,
  185. $node_array<edge>$ $pred$)}
  186. medskip
  187. BELLMAN_FORD takes as arguments a graph $G(V,E)$, a source node $s$ and an 
  188. edge_array $cost$ giving for each edge in $G$ a real (integer) cost. It 
  189. computes for each node $v$ in $G$ the distance $dist[v]$ from $s$ (cost of 
  190. the least cost path from $s$ to $v$) and the predecessor edge $pred[v]$ in 
  191. the shortest path tree. BELLMAN_FORD returns false if there is a negative
  192. cycle in $G$ and true otherwise
  193. The algorithm (cite{Be58}) has running time $O(|V|cdot |E|)$.
  194. }*/
  195. bool ALL_PAIRS_SHORTEST_PATHS(graph& G, const edge_array<int>&  cost,
  196.                                               node_matrix<int>& dist);
  197. /*{Mtext
  198. bigskip
  199. $bullet$ {bf All Pairs Shortest Paths }
  200. medskip
  201. $bool$ 
  202. parbox[t]{12cm}{ALL_PAIRS_SHORTEST_PATHS($graph& G$,
  203.                  $edge_array<int>&$ $cost$,
  204.  $node_matrix<int>&$ $dist$)}
  205. smallskip
  206. $bool$ 
  207. parbox[t]{12cm}{ALL_PAIRS_SHORTEST_PATHS($graph& G$,
  208.                  $edge_array<double>&$ $cost$,
  209.  $node_matrix<double>&$ $dist$)}
  210. medskip
  211. ALL_PAIRS_SHORTEST_PATHS takes as arguments a graph $G(V,E)$ and an 
  212. edge_array $cost$ giving for each edge in $G$ a real (integer) valued cost. 
  213. It computes for each node pair $(v,w)$ of $G$ the distance $dist(v,w)$ from 
  214. $v$ to $w$ (cost of the least cost path from $v$ to $w$).
  215. ALL_PAIRS_SHORTEST_PATHS returns false if there is a negative cycle in $G$
  216. and true otherwise.
  217. The algorithm (cite{Be58}, cite{Fl62}) has running time $O(|V|cdot |E| + |V|^2
  218.  log|V|)$.
  219. }*/
  220. //-----------------------------------------------------------------------------
  221. // maximum flow:
  222. //-----------------------------------------------------------------------------
  223. /*{Mtext
  224. bigskip
  225. $bullet$ {bf Maximum Flow }
  226. }*/
  227. int  MAX_FLOW(graph& G, node s, node t, const edge_array<int>& cap,
  228.                                               edge_array<int>& flow);
  229. /*{Mtext
  230. $int$ 
  231. parbox[t]{11cm}{MAX_FLOW($graph& G, node s, node t$, 
  232.                  $edge_array<int>& cap$,
  233.  $edge_array<int>& flow$)}
  234. smallskip
  235. $int$ 
  236. parbox[t]{11.5cm}{MAX_FLOW($graph& G, node s, node t$, 
  237.                  $edge_array<double>& cap$,
  238.  $edge_array<double>& flow$)}
  239. medskip
  240. MAX_FLOW takes as arguments a directed graph $G(V,E)$, a source node $s$, a 
  241. sink node $t$ and an edge_array $cap$ giving for each edge in $G$ a capacity. 
  242. It computes for every edge $e$ in $G$ a flow $flow[e]$ such that the total 
  243. flow from $s$ to $t$ is maximal and $flow[e] le cap[e]$ for all edges $e$. 
  244. MAX_FLOW returns the total flow from $s$ to $t$.
  245. The algorithm (cite{GT88}) has running time $O(|V|^3)$.
  246. }*/
  247. //-----------------------------------------------------------------------------
  248. // min cost flow:
  249. //-----------------------------------------------------------------------------
  250. int MIN_COST_MAX_FLOW(graph& G, node s, node t, const edge_array<int>& cap,
  251.                                                 const edge_array<int>& cost,
  252.                                                 edge_array<int>& flow);
  253. /*{Mtext
  254. $int$ 
  255. parbox[t]{11cm}{MIN_COST_MAX_FLOW($graph& G, node s, node t$, 
  256.                  $edge_array<int>& cap$,
  257.                  $edge_array<int>& cost$,
  258.  $edge_array<int>& flow$)}
  259. medskip
  260. MIN_COST_MAX_FLOW takes as arguments a directed graph $G(V,E)$, a source 
  261. node $s$, a sink node $t$, an edge_array $cap$ giving for each edge in $G$ a 
  262. capacity, and an edge_array $cost$ specifying for each edge an integer cost. 
  263. It computes for every edge $e$ in $G$ a flow $flow[e]$ such that the total 
  264. flow from $s$ to $t$ is maximal, the total cost of the flow is minimal,
  265. and $flow[e] le cap[e]$ for all edges $e$. 
  266. MIN_CONST_MAX_FLOW returns the total flow from $s$ to $t$.
  267. }*/
  268. //-----------------------------------------------------------------------------
  269. // minimum cut :
  270. //-----------------------------------------------------------------------------
  271. // Stoer and Wagner's algorithm
  272. /*{Mtext
  273. bigskip
  274. $bullet$ {bf Minimum Cut}
  275. }*/
  276. list<node> MIN_CUT(const graph& G, edge_array<int>& weight);
  277. /*{Mtext
  278. $list<node>$ MIN_CUT($graph& G$, $edge_array<int>& weight$)
  279. medskip
  280. MIN_CUT($G$, $weight$) takes as arguments a graph $G$ and an 
  281. edge_array
  282. giving for each edge an integer weight. The algorithm
  283. (cite{SW94}) computes
  284. the cut of minimum weight and returns it as a list of nodes. It
  285. has running time
  286. $O(|V|cdot |E| + |V|^2 log |V|)$.
  287. }*/ 
  288. //-----------------------------------------------------------------------------
  289. // matchings:
  290. //-----------------------------------------------------------------------------
  291. // Edmond's algorithm
  292. /*{Mtext
  293. bigskip
  294. $bullet$ {bf Maximum Cardinality Matching}
  295. }*/
  296. list<edge> MAX_CARD_MATCHING(graph& G, int heur = 1);    
  297. /*{Mtext
  298. $list<edge>$ MAX_CARD_MATCHING($graph& G$) 
  299. medskip
  300. MAX_CARD_MATCHING($G$) computes a maximum cardinality matching of $G$, i.e., 
  301. a maximal set of edges $M$ such that no two edges in $M$ share an end point.
  302. It returns $M$ as a list of edges.
  303. The algorithm (cite{E65}, cite{T83}) has running time $O(|V|cdot |E|cdotalpha(|E|))$.
  304. }*/
  305. // Hopcroft/Karp
  306. /*{Mtext
  307. bigskip
  308. $bullet$ {bf Maximum Cardinality Bipartite Matching}
  309. }*/
  310. list<edge> MAX_CARD_BIPARTITE_MATCHING(graph& G, const list<node>& A, const list<node>& B);
  311. /*{Mtext
  312. $list{tt <}edge>$ MAX_CARD_BIPARTITE_MATCHING($graph& G$, 
  313.                $list<node>& A$,
  314.        $list<node>& B$)
  315. medskip
  316. MAX_CARD_BIPARTITE_MATCHING takes as arguments a directed graph $G(V,E)$ and
  317. two lists $A$ and $B$ of nodes. All edges in $G$ must be directed from nodes
  318. in $A$ to nodes in $B$. It returns a maximum cardinality matching of $G$.
  319. The algorithm (cite{HK75}) has running time $O(|E|sqrt{|V|})$.
  320. }*/
  321. list<edge> MAX_CARD_BIPARTITE_MATCHING(graph& G);
  322. list<edge> MAX_CARD_BIPARTITE_MATCHING1(graph& G, const list<node>& A, const list<node>& B);
  323. list<edge> MAX_CARD_BIPARTITE_MATCHING1(graph& G);
  324. /*{Mtext
  325. bigskip
  326. $bullet$ {bf Maximum Weighted Matching}
  327. }*/
  328. list <edge> MAX_WEIGHT_MATCHING (const ugraph&,
  329.                                  const edge_array<int>&);
  330. /*{Mtext
  331. $list<edge>$ 
  332. parbox[t]{12.5cm}{MAX_WEIGHT_MATCHING($ugraph& G$,
  333.    $edge_array<int>& weight$)}
  334. smallskip
  335. $list<edge>$ 
  336. parbox[t]{12.5cm}{MAX_WEIGHT_MATCHING($ugraph& G$,
  337.  $edge_array<double>& weight$)}
  338. medskip
  339. MAX_WEIGHT_MATCHING takes as arguments an undirected graph $G$ 
  340. and an edge_array giving for each edge an 
  341. integer (real) weight. 
  342. It computes a maximum weighted matching of $G$, i.e., a set of edges $M$
  343. such that the sum of weights of all edges in $M$ is maximal and no two edges 
  344. in $M$ share an end point. MAX_WEIGHT_MATCHING returns $M$ as a 
  345. list of edges.
  346. The algorithm (cite{E65}, cite{G74}, cite{L76}) has running 
  347. time $O(|V|^3)$.
  348. }*/
  349. /*{Mtext
  350. bigskip
  351. $bullet$ {bf Maximum Weight Bipartite Matching}
  352. }*/
  353. list<edge> MAX_WEIGHT_BIPARTITE_MATCHING(graph& G, const list<node>&A, 
  354.                                                    const list<node>&B,
  355.                                                    const edge_array<int>&);
  356. /*{Mtext
  357. $list<edge>$ 
  358. parbox[t]{12.5cm}{MAX_WEIGHT_BIPARTITE_MATCHING($graph& G$,
  359.                    $list<node>& A$,
  360.    $list<node>& B$,
  361.    $edge_array<int>& weight$)}
  362. smallskip
  363. $list<edge>$ 
  364. parbox[t]{12.5cm}{MAX_WEIGHT_BIPARTITE_MATCHING($graph& G$,
  365.                  $list<node>& A$,
  366.  $list<node>& B$,
  367.  $edge_array<double>& weight$)}
  368. medskip
  369. MAX_WEIGHT_BIPARTITE_MATCHING takes as arguments a directed graph $G$, 
  370. two lists $A$ and $B$ of nodes and an edge_array giving for each edge an 
  371. integer (real) weight. All edges in $G$ must be directed from nodes in $A$ 
  372. to nodes in $B$. 
  373. It computes a maximum weight bipartite matching of $G$, i.e., a set of edges $M$
  374. such that the sum of weights of all edges in $M$ is maximal and no two edges 
  375. in $M$ share an end point. MAX_WEIGHT_BIPARTITE_MATCHING returns $M$ as a 
  376. list of edges.
  377. The algorithm (cite{FT87}) has running time $O(|V|cdot |E|)$.
  378. }*/
  379. //-----------------------------------------------------------------------------
  380. // spanning trees:
  381. //-----------------------------------------------------------------------------
  382. /*{Mtext
  383. bigskip
  384. $bullet$ {bf Spanning Tree}
  385. }*/
  386. list<edge> SPANNING_TREE(const graph& G);
  387. /*{Mtext
  388. $list<edge>$ SPANNING_TREE($graph& G$)
  389. medskip
  390. SPANNING_TREE takes as argument a graph $G(V,E)$. It computes a spanning
  391. tree $T$ of of the underlying undirected graph, SPANNING_TREE returns the 
  392. list of edges of $T$.
  393. The algorithm (cite{M84}) has running time $O(|V|+|E|)$.
  394. }*/
  395. /*{Mtext
  396. bigskip
  397. $bullet$ {bf Minimum Spanning Tree}
  398. }*/
  399. list<edge> MIN_SPANNING_TREE(const graph& G, const edge_array<int>& cost);
  400. /*{Mtext
  401. medskip
  402. $list<edge>$ MIN_SPANNING_TREE($graph& G, edge_array<int>& cost$)
  403. }*/
  404. list<edge> MIN_SPANNING_TREE1(const graph& G, const edge_array<int>& cost);
  405. /*{Mtext
  406. smallskip
  407. $list<edge>$ MIN_SPANNING_TREE1($graph& G, edge_array<double>& cost$)
  408. medskip
  409. MIN_SPANNING_TREE takes as argument an undirected graph $G(V,E)$ and an 
  410. edge_array $cost$ giving for each edge an integer cost. 
  411. It computes a minimum spanning 
  412. tree $T$ of $G$, i.e., a spanning tree such that the sum of all edge costs
  413. is minimal. MIN_SPANNING_TREE returns the list of edges of $T$.
  414. The algorithm (cite{Kr56}) has running time $O(|E|log|V|)$.
  415. }*/
  416. //-----------------------------------------------------------------------------
  417. // planar graphs
  418. //-----------------------------------------------------------------------------
  419. /*{Mtext
  420. subsection{Algorithms for Planar Graphs}
  421. label{Algorithms for Planar Graphs}
  422. }*/
  423. /*{Mtext
  424. bigskip
  425. $bullet$ {bf Planarity Test}
  426. }*/
  427. bool PLANAR(graph&, bool embed=false);
  428. /*{Mtext
  429. $bool$ PLANAR($graph& G, bool embed=false$)
  430. medskip
  431. PLANAR takes as input a directed graph $G(V,E)$ and performs a planarity test
  432. for $G$. If the second argument $embed$ has value $true$ and $G$ is a planar 
  433. graph it is transformed into a planar map (a combinatorial embedding such that
  434. the edges in all adjacency lists are in clockwise ordering). PLANAR returns 
  435. true if $G$ is planar and false otherwise.
  436. The algorithm (cite{HT74}) has running time $O(|V|+|E|)$.
  437. }*/
  438. bool PLANAR(graph&, list<edge>&, bool embed=false);
  439. /*{Mtext
  440. $bool$ PLANAR($graph& G, list<edge>& el$)
  441. medskip
  442. PLANAR takes as input a directed graph $G(V,E)$ and performs a planarity test
  443. for $G$. PLANAR returns true if $G$ is planar and false otherwise.
  444. If $G$ is not planar a Kuratowsky-Subgraph is computed and returned in $el$.  
  445. }*/
  446. list<edge> make_biconnected_graph(graph&G);
  447. /*{Mtext
  448. bigskip
  449. $bullet$ {bf Triangulation}
  450. }*/
  451. list<edge> TRIANGULATE_PLANAR_MAP(graph&);
  452. /*{Mtext
  453. $list{tt <}edge{tt >}$ TRIANGULATE_PLANAR_MAP($graph& G$)
  454. medskip
  455. TRIANGULATE_PLANAR_MAP takes a directed graph $G$ representing a planar map.
  456. It triangulates the faces of $G$ by inserting additional edges. The list of
  457. inserted edges is returned. precond $G$ must be connected.
  458. The algorithm (cite{HU89}) has running time $O(|V|+|E|)$.
  459. }*/
  460. /*{Mtext
  461. bigskip
  462. $bullet$ {bf Straight Line Embedding}
  463. }*/
  464. int STRAIGHT_LINE_EMBEDDING(graph& G,node_array<int>& xcoord,
  465.                                      node_array<int>& ycoord);
  466. /*{Mtext
  467. $int$ 
  468. parbox[t]{12.5cm}{STRAIGHT_LINE_EMBEDDING($graph& G$, 
  469.                  $node_array<int>& xcoord$,
  470.  $node_array<int>& ycoord$)}
  471. medskip
  472. STRAIGHT_LINE_EMBEDDING takes as argument a directed graph $G$ representing
  473. a planar map. It computes a straight line embedding of $G$ by assigning 
  474. non-negative integer coordinates ($xcoord$ and $ycoord$) in the range 
  475. $0..2(n-1)$ to the nodes. STRAIGHT_LINE_EMBEDDING returns the maximal 
  476. coordinate.
  477. The algorithm (cite{Fa48}) has running time $O(|V|^2)$.
  478. }*/
  479. int STRAIGHT_LINE_EMBEDDING2(graph& G, node_array<int>& xcoord,
  480.                                        node_array<int>& ycoord);
  481. //-----------------------------------------------------------------------------
  482. // floating point (double) versions 
  483. //-----------------------------------------------------------------------------
  484. void DIJKSTRA(const graph& G, node s, const edge_array<double>& cost, 
  485.                                             node_array<double>& dist, 
  486.                                             node_array<edge>& pred);
  487. bool BELLMAN_FORD(const graph& G, node s, const edge_array<double>& cost,
  488.                                                 node_array<double>& dist,
  489.                                                 node_array<edge>& pred);
  490. bool ALL_PAIRS_SHORTEST_PATHS(graph& G, const edge_array<double>&  cost,
  491.                                               node_matrix<double>& dist);
  492. double MAX_FLOW(graph& G, node s, node t, const edge_array<double>& cap,
  493.                                                 edge_array<double>& flow);
  494. list <edge> MAX_WEIGHT_MATCHING (const ugraph&,
  495.                                    const edge_array<double>&);
  496.    
  497. list<edge> MAX_WEIGHT_BIPARTITE_MATCHING(graph& G, const list<node>&, 
  498.                                                    const list<node>&,
  499.                                                    const edge_array<double>&);
  500. int STRAIGHT_LINE_EMBEDDING(graph& G,node_array<double>& xcoord,
  501.                                      node_array<double>& ycoord);
  502. int STRAIGHT_LINE_EMBEDDING2(graph& G,node_array<double>& xcoord,
  503.                                       node_array<double>& ycoord);
  504. list<edge> MIN_SPANNING_TREE(const graph& G, const edge_array<double>& cost);
  505. list<edge> MIN_SPANNING_TREE(const graph& G, const edge_array<double>& cost);
  506. #endif