COIN-OR::LEMON - Graph Library

Changeset 443:178fb74b22d1 in lemon-0.x


Ignore:
Timestamp:
04/27/04 15:44:14 (16 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@591
Message:
  • list_graph.h:
    • node_item and edge_item are structs and not classes
    • operator<< is inline
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/list_graph.h

    r436 r443  
    1818
    1919  class ListGraph {
    20     class node_item;
    21     class edge_item;
     20    struct node_item;
     21    struct edge_item;
    2222  public:
    2323    class Node;
     
    8585    node_item* _last_node;
    8686
    87     class node_item {
    88       friend class ListGraph;
    89       template <typename T> friend class NodeMap;
    90      
    91       friend class Node;
    92       friend class NodeIt;
    93       friend class Edge;
    94       friend class EdgeIt;
    95       friend class OutEdgeIt;
    96       friend class InEdgeIt;
    97       friend class SymEdgeIt;
    98       friend std::ostream& operator<<(std::ostream& os, const Node& i);
    99       friend std::ostream& operator<<(std::ostream& os, const Edge& i);
    100       //ListGraph* G;
     87    struct node_item {
    10188      int id;
    10289      edge_item* _first_out_edge;
     
    10693      node_item* _next_node;
    10794      node_item* _prev_node;
    108     public:
    109       node_item() { }
    110     };
    111 
    112     class edge_item {
    113       friend class ListGraph;
    114       template <typename T> friend class EdgeMap;
    115 
    116       friend class Node;
    117       friend class NodeIt;
    118       friend class Edge;
    119       friend class EdgeIt;
    120       friend class OutEdgeIt;
    121       friend class InEdgeIt;
    122       friend class SymEdgeIt;
    123       friend std::ostream& operator<<(std::ostream& os, const Edge& i);
    124       //ListGraph* G;
     95    };
     96
     97    struct edge_item {
    12598      int id;
    12699      node_item* _tail;
     
    130103      edge_item* _next_in;
    131104      edge_item* _prev_in;
    132     public:
    133       edge_item() { }
    134105    };
    135106
     
    547518  };
    548519
     520  inline
    549521  std::ostream& operator<<(std::ostream& os, const ListGraph::Node& i) {
    550522    if (i.valid())
    551       os << i.node->id; 
     523      os << i.node->id;
    552524    else
    553525      os << "invalid";
    554526    return os;
    555527  }
     528
     529  inline
    556530  std::ostream& operator<<(std::ostream& os, const ListGraph::Edge& i) {
    557531    if (i.valid())
    558       os << "(" << i.edge->_tail->id << "--" << i.edge->id << "->" << i.edge->_head->id << ")";
     532      os << "(" << i.tailNode() << "--" << i.edge->id << "->"
     533         << i.headNode() << ")";
    559534    else
    560535      os << "invalid";
Note: See TracChangeset for help on using the changeset viewer.