COIN-OR::LEMON - Graph Library

Ignore:
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • doc/CMakeLists.txt

    r895 r791  
    2727    COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
    2828    COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
    29     COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/planar.png ${CMAKE_CURRENT_SOURCE_DIR}/images/planar.eps
    3029    COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
    3130    COMMAND ${CMAKE_COMMAND} -E remove_directory html
  • doc/Makefile.am

    r895 r791  
    2929        edge_biconnected_components.eps \
    3030        node_biconnected_components.eps \
    31         planar.eps \
    3231        strongly_connected_components.eps
    3332
  • lemon/planarity.h

    r896 r862  
    519519  ///
    520520  /// This function implements the Boyer-Myrvold algorithm for
    521   /// planarity checking of an undirected simple graph. It is a simplified
     521  /// planarity checking of an undirected graph. It is a simplified
    522522  /// version of the PlanarEmbedding algorithm class because neither
    523   /// the embedding nor the Kuratowski subdivisons are computed.
     523  /// the embedding nor the kuratowski subdivisons are not computed.
    524524  template <typename GR>
    525525  bool checkPlanarity(const GR& graph) {
     
    533533  ///
    534534  /// This class implements the Boyer-Myrvold algorithm for planar
    535   /// embedding of an undirected simple graph. The planar embedding is an
     535  /// embedding of an undirected graph. The planar embedding is an
    536536  /// ordering of the outgoing edges of the nodes, which is a possible
    537537  /// configuration to draw the graph in the plane. If there is not
    538   /// such ordering then the graph contains a K<sub>5</sub> (full graph
    539   /// with 5 nodes) or a K<sub>3,3</sub> (complete bipartite graph on
    540   /// 3 Red and 3 Blue nodes) subdivision.
     538  /// such ordering then the graph contains a \f$ K_5 \f$ (full graph
     539  /// with 5 nodes) or a \f$ K_{3,3} \f$ (complete bipartite graph on
     540  /// 3 ANode and 3 BNode) subdivision.
    541541  ///
    542542  /// The current implementation calculates either an embedding or a
    543   /// Kuratowski subdivision. The running time of the algorithm is O(n).
    544   ///
    545   /// \see PlanarDrawing, checkPlanarity()
     543  /// Kuratowski subdivision. The running time of the algorithm is
     544  /// \f$ O(n) \f$.
    546545  template <typename Graph>
    547546  class PlanarEmbedding {
     
    593592  public:
    594593
    595     /// \brief The map type for storing the embedding
    596     ///
    597     /// The map type for storing the embedding.
    598     /// \see embeddingMap()
     594    /// \brief The map for store of embedding
    599595    typedef typename Graph::template ArcMap<Arc> EmbeddingMap;
    600596
    601597    /// \brief Constructor
    602598    ///
    603     /// Constructor.
    604     /// \pre The graph must be simple, i.e. it should not
    605     /// contain parallel or loop arcs.
     599    /// \note The graph should be simple, i.e. parallel and loop arc
     600    /// free.
    606601    PlanarEmbedding(const Graph& graph)
    607602      : _graph(graph), _embedding(_graph), _kuratowski(graph, false) {}
    608603
    609     /// \brief Run the algorithm.
     604    /// \brief Runs the algorithm.
    610605    ///
    611     /// This function runs the algorithm.
    612     /// \param kuratowski If this parameter is set to \c false, then the
     606    /// Runs the algorithm.
     607    /// \param kuratowski If the parameter is false, then the
    613608    /// algorithm does not compute a Kuratowski subdivision.
    614     /// \return \c true if the graph is planar.
     609    ///\return %True when the graph is planar.
    615610    bool run(bool kuratowski = true) {
    616611      typedef _planarity_bits::PlanarityVisitor<Graph> Visitor;
     
    705700    }
    706701
    707     /// \brief Give back the successor of an arc
     702    /// \brief Gives back the successor of an arc
    708703    ///
    709     /// This function gives back the successor of an arc. It makes
     704    /// Gives back the successor of an arc. This function makes
    710705    /// possible to query the cyclic order of the outgoing arcs from
    711706    /// a node.
     
    714709    }
    715710
    716     /// \brief Give back the calculated embedding map
     711    /// \brief Gives back the calculated embedding map
    717712    ///
    718     /// This function gives back the calculated embedding map, which
    719     /// contains the successor of each arc in the cyclic order of the
    720     /// outgoing arcs of its source node.
     713    /// The returned map contains the successor of each arc in the
     714    /// graph.
    721715    const EmbeddingMap& embeddingMap() const {
    722716      return _embedding;
    723717    }
    724718
    725     /// \brief Give back \c true if the given edge is in the Kuratowski
     719    /// \brief Gives back true if the undirected arc is in the
     720    /// kuratowski subdivision
     721    ///
     722    /// Gives back true if the undirected arc is in the kuratowski
    726723    /// subdivision
    727     ///
    728     /// This function gives back \c true if the given edge is in the found
    729     /// Kuratowski subdivision.
    730     /// \pre The \c run() function must be called with \c true parameter
    731     /// before using this function.
    732     bool kuratowski(const Edge& edge) const {
     724    /// \note The \c run() had to be called with true value.
     725    bool kuratowski(const Edge& edge) {
    733726      return _kuratowski[edge];
    734727    }
     
    20672060  ///
    20682061  /// The planar drawing algorithm calculates positions for the nodes
    2069   /// in the plane. These coordinates satisfy that if the edges are
    2070   /// represented with straight lines, then they will not intersect
     2062  /// in the plane which coordinates satisfy that if the arcs are
     2063  /// represented with straight lines then they will not intersect
    20712064  /// each other.
    20722065  ///
    2073   /// Scnyder's algorithm embeds the graph on an \c (n-2)x(n-2) size grid,
    2074   /// i.e. each node will be located in the \c [0..n-2]x[0..n-2] square.
     2066  /// Scnyder's algorithm embeds the graph on \c (n-2,n-2) size grid,
     2067  /// i.e. each node will be located in the \c [0,n-2]x[0,n-2] square.
    20752068  /// The time complexity of the algorithm is O(n).
    2076   ///
    2077   /// \see PlanarEmbedding
    20782069  template <typename Graph>
    20792070  class PlanarDrawing {
     
    20822073    TEMPLATE_GRAPH_TYPEDEFS(Graph);
    20832074
    2084     /// \brief The point type for storing coordinates
     2075    /// \brief The point type for store coordinates
    20852076    typedef dim2::Point<int> Point;
    2086     /// \brief The map type for storing the coordinates of the nodes
     2077    /// \brief The map type for store coordinates
    20872078    typedef typename Graph::template NodeMap<Point> PointMap;
    20882079
     
    20912082    ///
    20922083    /// Constructor
    2093     /// \pre The graph must be simple, i.e. it should not
    2094     /// contain parallel or loop arcs.
     2084    /// \pre The graph should be simple, i.e. loop and parallel arc free.
    20952085    PlanarDrawing(const Graph& graph)
    20962086      : _graph(graph), _point_map(graph) {}
     
    23772367  public:
    23782368
    2379     /// \brief Calculate the node positions
     2369    /// \brief Calculates the node positions
    23802370    ///
    2381     /// This function calculates the node positions on the plane.
    2382     /// \return \c true if the graph is planar.
     2371    /// This function calculates the node positions.
     2372    /// \return %True if the graph is planar.
    23832373    bool run() {
    23842374      PlanarEmbedding<Graph> pe(_graph);
     
    23892379    }
    23902380
    2391     /// \brief Calculate the node positions according to a
     2381    /// \brief Calculates the node positions according to a
    23922382    /// combinatorical embedding
    23932383    ///
    2394     /// This function calculates the node positions on the plane.
    2395     /// The given \c embedding map should contain a valid combinatorical
    2396     /// embedding, i.e. a valid cyclic order of the arcs.
    2397     /// It can be computed using PlanarEmbedding.
     2384    /// This function calculates the node locations. The \c embedding
     2385    /// parameter should contain a valid combinatorical embedding, i.e.
     2386    /// a valid cyclic order of the arcs.
    23982387    template <typename EmbeddingMap>
    23992388    void run(const EmbeddingMap& embedding) {
     
    24352424    /// \brief The coordinate of the given node
    24362425    ///
    2437     /// This function returns the coordinate of the given node.
     2426    /// The coordinate of the given node.
    24382427    Point operator[](const Node& node) const {
    24392428      return _point_map[node];
    24402429    }
    24412430
    2442     /// \brief Return the grid embedding in a node map
     2431    /// \brief Returns the grid embedding in a \e NodeMap.
    24432432    ///
    2444     /// This function returns the grid embedding in a node map of
    2445     /// \c dim2::Point<int> coordinates.
     2433    /// Returns the grid embedding in a \e NodeMap of \c dim2::Point<int> .
    24462434    const PointMap& coords() const {
    24472435      return _point_map;
     
    24832471  ///
    24842472  /// The graph coloring problem is the coloring of the graph nodes
    2485   /// so that there are no adjacent nodes with the same color. The
    2486   /// planar graphs can always be colored with four colors, which is
    2487   /// proved by Appel and Haken. Their proofs provide a quadratic
     2473  /// that there are not adjacent nodes with the same color. The
     2474  /// planar graphs can be always colored with four colors, it is
     2475  /// proved by Appel and Haken and their proofs provide a quadratic
    24882476  /// time algorithm for four coloring, but it could not be used to
    2489   /// implement an efficient algorithm. The five and six coloring can be
    2490   /// made in linear time, but in this class, the five coloring has
     2477  /// implement efficient algorithm. The five and six coloring can be
     2478  /// made in linear time, but in this class the five coloring has
    24912479  /// quadratic worst case time complexity. The two coloring (if
    24922480  /// possible) is solvable with a graph search algorithm and it is
    24932481  /// implemented in \ref bipartitePartitions() function in LEMON. To
    2494   /// decide whether a planar graph is three colorable is NP-complete.
     2482  /// decide whether the planar graph is three colorable is
     2483  /// NP-complete.
    24952484  ///
    24962485  /// This class contains member functions for calculate colorings
    24972486  /// with five and six colors. The six coloring algorithm is a simple
    24982487  /// greedy coloring on the backward minimum outgoing order of nodes.
    2499   /// This order can be computed by selecting the node with least
    2500   /// outgoing arcs to unprocessed nodes in each phase. This order
     2488  /// This order can be computed as in each phase the node with least
     2489  /// outgoing arcs to unprocessed nodes is chosen. This order
    25012490  /// guarantees that when a node is chosen for coloring it has at
    25022491  /// most five already colored adjacents. The five coloring algorithm
     
    25112500    TEMPLATE_GRAPH_TYPEDEFS(Graph);
    25122501
    2513     /// \brief The map type for storing color indices
     2502    /// \brief The map type for store color indexes
    25142503    typedef typename Graph::template NodeMap<int> IndexMap;
    2515     /// \brief The map type for storing colors
    2516     ///
    2517     /// The map type for storing colors.
    2518     /// \see Palette, Color
     2504    /// \brief The map type for store colors
    25192505    typedef ComposeMap<Palette, IndexMap> ColorMap;
    25202506
    25212507    /// \brief Constructor
    25222508    ///
    2523     /// Constructor.
    2524     /// \pre The graph must be simple, i.e. it should not
    2525     /// contain parallel or loop arcs.
     2509    /// Constructor
     2510    /// \pre The graph should be simple, i.e. loop and parallel arc free.
    25262511    PlanarColoring(const Graph& graph)
    25272512      : _graph(graph), _color_map(graph), _palette(0) {
     
    25342519    }
    25352520
    2536     /// \brief Return the node map of color indices
     2521    /// \brief Returns the \e NodeMap of color indexes
    25372522    ///
    2538     /// This function returns the node map of color indices. The values are
    2539     /// in the range \c [0..4] or \c [0..5] according to the coloring method.
     2523    /// Returns the \e NodeMap of color indexes. The values are in the
     2524    /// range \c [0..4] or \c [0..5] according to the coloring method.
    25402525    IndexMap colorIndexMap() const {
    25412526      return _color_map;
    25422527    }
    25432528
    2544     /// \brief Return the node map of colors
     2529    /// \brief Returns the \e NodeMap of colors
    25452530    ///
    2546     /// This function returns the node map of colors. The values are among
    2547     /// five or six distinct \ref lemon::Color "colors".
     2531    /// Returns the \e NodeMap of colors. The values are five or six
     2532    /// distinct \ref lemon::Color "colors".
    25482533    ColorMap colorMap() const {
    25492534      return composeMap(_palette, _color_map);
    25502535    }
    25512536
    2552     /// \brief Return the color index of the node
     2537    /// \brief Returns the color index of the node
    25532538    ///
    2554     /// This function returns the color index of the given node. The value is
    2555     /// in the range \c [0..4] or \c [0..5] according to the coloring method.
     2539    /// Returns the color index of the node. The values are in the
     2540    /// range \c [0..4] or \c [0..5] according to the coloring method.
    25562541    int colorIndex(const Node& node) const {
    25572542      return _color_map[node];
    25582543    }
    25592544
    2560     /// \brief Return the color of the node
     2545    /// \brief Returns the color of the node
    25612546    ///
    2562     /// This function returns the color of the given node. The value is among
    2563     /// five or six distinct \ref lemon::Color "colors".
     2547    /// Returns the color of the node. The values are five or six
     2548    /// distinct \ref lemon::Color "colors".
    25642549    Color color(const Node& node) const {
    25652550      return _palette[_color_map[node]];
     
    25672552
    25682553
    2569     /// \brief Calculate a coloring with at most six colors
     2554    /// \brief Calculates a coloring with at most six colors
    25702555    ///
    25712556    /// This function calculates a coloring with at most six colors. The time
    25722557    /// complexity of this variant is linear in the size of the graph.
    2573     /// \return \c true if the algorithm could color the graph with six colors.
    2574     /// If the algorithm fails, then the graph is not planar.
    2575     /// \note This function can return \c true if the graph is not
    2576     /// planar, but it can be colored with at most six colors.
     2558    /// \return %True when the algorithm could color the graph with six color.
     2559    /// If the algorithm fails, then the graph could not be planar.
     2560    /// \note This function can return true if the graph is not
     2561    /// planar but it can be colored with 6 colors.
    25772562    bool runSixColoring() {
    25782563
     
    26762661  public:
    26772662
    2678     /// \brief Calculate a coloring with at most five colors
     2663    /// \brief Calculates a coloring with at most five colors
    26792664    ///
    26802665    /// This function calculates a coloring with at most five
    26812666    /// colors. The worst case time complexity of this variant is
    26822667    /// quadratic in the size of the graph.
    2683     /// \param embedding This map should contain a valid combinatorical
    2684     /// embedding, i.e. a valid cyclic order of the arcs.
    2685     /// It can be computed using PlanarEmbedding.
    26862668    template <typename EmbeddingMap>
    26872669    void runFiveColoring(const EmbeddingMap& embedding) {
     
    27302712    }
    27312713
    2732     /// \brief Calculate a coloring with at most five colors
     2714    /// \brief Calculates a coloring with at most five colors
    27332715    ///
    27342716    /// This function calculates a coloring with at most five
    27352717    /// colors. The worst case time complexity of this variant is
    27362718    /// quadratic in the size of the graph.
    2737     /// \return \c true if the graph is planar.
     2719    /// \return %True when the graph is planar.
    27382720    bool runFiveColoring() {
    27392721      PlanarEmbedding<Graph> pe(_graph);
Note: See TracChangeset for help on using the changeset viewer.