src/work/marci/graph_wrapper.h
changeset 435 8f1dece01cc4
parent 409 7ab7f083760a
child 438 a0a2709cf178
equal deleted inserted replaced
50:07f839db93b0 51:f3834809d12f
  1066     bool inTClass(const Node& n) const {
  1066     bool inTClass(const Node& n) const {
  1067       return (*(this->s_false_t_true_map))[n];
  1067       return (*(this->s_false_t_true_map))[n];
  1068     }
  1068     }
  1069   };
  1069   };
  1070 
  1070 
       
  1071   template<typename Graph>
       
  1072   class stGraphWrapper;
       
  1073 
       
  1074 //   template<typename Graph> 
       
  1075 //   std::ostream& 
       
  1076 //   operator<<(std::ostream& os, const typename stGraphWrapper<Graph>::Node& i) { 
       
  1077 //     os << "(node: " << typename Graph::Node(i) << " spec: " << i.spec <<")"; 
       
  1078 //     return os; 
       
  1079 //   }
       
  1080 //   template<typename Graph> 
       
  1081 //   std::ostream& 
       
  1082 //   operator<<(std::ostream& os, const typename stGraphWrapper<Graph>::Edge& i) { 
       
  1083 //     os << "(edge: " << typename Graph::Edge(i) << " spec: " << i.spec << 
       
  1084 //       " node: " << i.n << ")"; 
       
  1085 //     return os; 
       
  1086 //   }
  1071 
  1087 
  1072   /// experimentral, do not try it.
  1088   /// experimentral, do not try it.
  1073   /// It eats a bipartite graph, oriented from S to T.
  1089   /// It eats a bipartite graph, oriented from S to T.
  1074   /// Such one can be made e.g. by the above wrapper.
  1090   /// Such one can be made e.g. by the above wrapper.
  1075   template<typename Graph>
  1091   template<typename Graph>
  1120 
  1136 
  1121     stGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) , 
  1137     stGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) , 
  1122 				    S_NODE(INVALID, 1), 
  1138 				    S_NODE(INVALID, 1), 
  1123 				    T_NODE(INVALID, 2) { }
  1139 				    T_NODE(INVALID, 2) { }
  1124 
  1140 
       
  1141     
       
  1142 //    std::ostream& 
       
  1143 //    operator<<(std::ostream& os, const /*typename stGraphWrapper<Graph>::*/Node& i);
       
  1144 //    friend std::ostream& 
       
  1145 //    operator<<(std::ostream& os, const /*typename stGraphWrapper<Graph>::*/Node& i);
       
  1146 //    friend std::ostream& 
       
  1147 //    operator<<(std::ostream& os, const /*typename stGraphWrapper<Graph>::*/Edge& i);
       
  1148 
  1125     class Node : public Graph::Node {
  1149     class Node : public Graph::Node {
  1126     protected:
  1150     protected:
  1127       friend class GraphWrapper<Graph>;
  1151       friend class GraphWrapper<Graph>;
  1128       friend class stGraphWrapper<Graph>;
  1152       friend class stGraphWrapper<Graph>;
  1129       template <typename T> friend class NodeMap;
  1153       template <typename T> friend class NodeMap;
  1145       friend bool operator!=(const Node& u, const Node& v) { 
  1169       friend bool operator!=(const Node& u, const Node& v) { 
  1146 	return (v.spec!=u.spec || 
  1170 	return (v.spec!=u.spec || 
  1147 		static_cast<typename Graph::Node>(u)!=
  1171 		static_cast<typename Graph::Node>(u)!=
  1148 		static_cast<typename Graph::Node>(v));
  1172 		static_cast<typename Graph::Node>(v));
  1149       }
  1173       }
  1150       friend std::ostream& operator<<(std::ostream& os, const Node& i);
  1174 //      template<typename G> 
       
  1175 //      friend std::ostream& 
       
  1176 //      operator<<(std::ostream& os, const typename stGraphWrapper<G>::Node& i); 
       
  1177       friend std::ostream& operator<< (std::ostream& os, const Node& i);
  1151       int getSpec() const { return spec; }
  1178       int getSpec() const { return spec; }
  1152     };
  1179     };
  1153 
  1180 
  1154     class NodeIt { 
  1181     class NodeIt { 
  1155       friend class GraphWrapper<Graph>;
  1182       friend class GraphWrapper<Graph>;
  1190 	return (v.spec!=u.spec || 
  1217 	return (v.spec!=u.spec || 
  1191 		static_cast<typename Graph::Edge>(u)!=
  1218 		static_cast<typename Graph::Edge>(u)!=
  1192 		static_cast<typename Graph::Edge>(v) || 
  1219 		static_cast<typename Graph::Edge>(v) || 
  1193 		u.n!=v.n);
  1220 		u.n!=v.n);
  1194       } 
  1221       } 
  1195       friend std::ostream& operator<<(std::ostream& os, const Edge& i);
  1222 //      template<typename G> 
       
  1223 //      friend std::ostream& 
       
  1224 //      operator<<(std::ostream& os, const typename stGraphWrapper<G>::Edge& i); 
       
  1225       friend std::ostream& operator<< (std::ostream& os, const Edge& i);
  1196       int getSpec() const { return spec; }
  1226       int getSpec() const { return spec; }
  1197     };
  1227     };
  1198 
  1228 
  1199     class OutEdgeIt { 
  1229     class OutEdgeIt { 
  1200       friend class GraphWrapper<Graph>;
  1230       friend class GraphWrapper<Graph>;
  1599 // 	  break;
  1629 // 	  break;
  1600 // 	}
  1630 // 	}
  1601 //       }
  1631 //       }
  1602 //     };
  1632 //     };
  1603 
  1633 
  1604     friend std::ostream& operator<<(std::ostream& os, const Node& i) { 
  1634 //  template<typename G> 
       
  1635     friend std::ostream& 
       
  1636     operator<<(std::ostream& os, const /*typename stGraphWrapper<Graph>::*/Node& i) { 
  1605       os << "(node: " << typename Graph::Node(i) << " spec: " << i.spec <<")"; 
  1637       os << "(node: " << typename Graph::Node(i) << " spec: " << i.spec <<")"; 
  1606       return os; 
  1638       return os; 
  1607     }
  1639     }
  1608     friend std::ostream& operator<<(std::ostream& os, const Edge& i) { 
  1640 //  template<typename G> 
       
  1641     friend std::ostream& 
       
  1642     operator<<(std::ostream& os, const /*typename stGraphWrapper<Graph>::*/Edge& i) { 
  1609       os << "(edge: " << typename Graph::Edge(i) << " spec: " << i.spec << 
  1643       os << "(edge: " << typename Graph::Edge(i) << " spec: " << i.spec << 
  1610 	" node: " << i.n << ")"; 
  1644 	" node: " << i.n << ")"; 
  1611       return os; 
  1645       return os; 
  1612     }
  1646     }
  1613 
  1647