1.1 --- a/src/work/list_graph.h Tue Apr 27 13:35:09 2004 +0000
1.2 +++ b/src/work/list_graph.h Tue Apr 27 13:44:14 2004 +0000
1.3 @@ -17,8 +17,8 @@
1.4 }
1.5
1.6 class ListGraph {
1.7 - class node_item;
1.8 - class edge_item;
1.9 + struct node_item;
1.10 + struct edge_item;
1.11 public:
1.12 class Node;
1.13 class NodeIt;
1.14 @@ -84,20 +84,7 @@
1.15 node_item* _first_node;
1.16 node_item* _last_node;
1.17
1.18 - class node_item {
1.19 - friend class ListGraph;
1.20 - template <typename T> friend class NodeMap;
1.21 -
1.22 - friend class Node;
1.23 - friend class NodeIt;
1.24 - friend class Edge;
1.25 - friend class EdgeIt;
1.26 - friend class OutEdgeIt;
1.27 - friend class InEdgeIt;
1.28 - friend class SymEdgeIt;
1.29 - friend std::ostream& operator<<(std::ostream& os, const Node& i);
1.30 - friend std::ostream& operator<<(std::ostream& os, const Edge& i);
1.31 - //ListGraph* G;
1.32 + struct node_item {
1.33 int id;
1.34 edge_item* _first_out_edge;
1.35 edge_item* _last_out_edge;
1.36 @@ -105,23 +92,9 @@
1.37 edge_item* _last_in_edge;
1.38 node_item* _next_node;
1.39 node_item* _prev_node;
1.40 - public:
1.41 - node_item() { }
1.42 };
1.43
1.44 - class edge_item {
1.45 - friend class ListGraph;
1.46 - template <typename T> friend class EdgeMap;
1.47 -
1.48 - friend class Node;
1.49 - friend class NodeIt;
1.50 - friend class Edge;
1.51 - friend class EdgeIt;
1.52 - friend class OutEdgeIt;
1.53 - friend class InEdgeIt;
1.54 - friend class SymEdgeIt;
1.55 - friend std::ostream& operator<<(std::ostream& os, const Edge& i);
1.56 - //ListGraph* G;
1.57 + struct edge_item {
1.58 int id;
1.59 node_item* _tail;
1.60 node_item* _head;
1.61 @@ -129,8 +102,6 @@
1.62 edge_item* _prev_out;
1.63 edge_item* _next_in;
1.64 edge_item* _prev_in;
1.65 - public:
1.66 - edge_item() { }
1.67 };
1.68
1.69 node_item* _add_node() {
1.70 @@ -546,16 +517,20 @@
1.71 };
1.72 };
1.73
1.74 + inline
1.75 std::ostream& operator<<(std::ostream& os, const ListGraph::Node& i) {
1.76 if (i.valid())
1.77 - os << i.node->id;
1.78 + os << i.node->id;
1.79 else
1.80 os << "invalid";
1.81 return os;
1.82 }
1.83 +
1.84 + inline
1.85 std::ostream& operator<<(std::ostream& os, const ListGraph::Edge& i) {
1.86 if (i.valid())
1.87 - os << "(" << i.edge->_tail->id << "--" << i.edge->id << "->" << i.edge->_head->id << ")";
1.88 + os << "(" << i.tailNode() << "--" << i.edge->id << "->"
1.89 + << i.headNode() << ")";
1.90 else
1.91 os << "invalid";
1.92 return os;