Changeset 905:5be029d19c98 in lemon0.x for src
 Timestamp:
 09/23/04 16:40:45 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1215
 Location:
 src
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

src/benchmark/hcube.cc
r840 r905 67 67 68 68 // for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P(); 69 for(int i=0;i<dim*(1<<dim);i++) 69 Edge te; 70 for(int i=0;i<dim*(1<<dim);i++) { 71 te.setToId(((long long int)(i)*93505)%(dim*(1<<dim))); 70 72 // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P(); 71 map[Edge(((long long int)(i)*93505)%(dim*(1<<dim)))]=P(); 72 73 map[te]=P(); 74 } 75 73 76 // for(int i=0;i<(1<<dim);i++) { 74 77 // int mul= (1<<(numOfZeros(i,dim)/4)); 
src/hugo/list_graph.h
r904 r905 77 77 // Create map registries. 78 78 CREATE_MAP_REGISTRIES; 79 // /Create node and edge maps.79 // Create node and edge maps. 80 80 CREATE_MAPS(ArrayMap); 81 81 … … 322 322 template <typename T> friend class EdgeMap; 323 323 324 //template <typename T> friend class SymListGraph::SymEdgeMap; 325 //friend Edge SymListGraph::opposite(Edge) const; 324 friend class SymListGraph; 326 325 327 326 friend class Node; … … 343 342 bool operator!=(const Edge i) const {return n!=i.n;} 344 343 bool operator<(const Edge i) const {return n<i.n;} 345 ///\bug This is a workaround until somebody tells me how to346 ///make class \c SymListGraph::SymEdgeMap friend of Edge347 int &idref() {return n;}348 const int &idref() const {return n;}349 344 // ///Validity check 350 345 // operator bool() { return n!=1; } … … 364 359 EdgeIt(const ListGraph& _G, Edge e) : Edge(e), G(&_G) { } 365 360 EdgeIt() : Edge() { } 366 ///\bug This is a workaround until somebody tells me how to367 ///make class \c SymListGraph::SymEdgeMap friend of Edge368 int &idref() {return n;}369 361 EdgeIt &operator++() { 370 362 if(G>edges[n].next_in!=1) n=G>edges[n].next_in; … … 466 458 { 467 459 Edge f; 468 f. idref() = e.idref()  2*(e.idref()%2) + 1;460 f.n = e.n  2*(e.n%2) + 1; 469 461 return f; 470 462 } … … 605 597 /// The ID of the \ref INVALID node is 1. 606 598 ///\return The ID of the node \c v. 607 int id(Node v) const{ return v.n; }599 static int id(Node v) { return v.n; } 608 600 /// Edge ID. 609 601 … … 614 606 /// The ID of the \ref INVALID edge is 1. 615 607 ///\return The ID of the edge \c e. 616 int id(Edge e) const{ return 1; }608 static int id(Edge e) { return 1; } 617 609 618 610 /// Adds a new node to the graph. … … 684 676 protected: 685 677 int n; 686 friend int NodeSet::id(Node v) const;678 friend int NodeSet::id(Node v); 687 679 Node(int nn) {n=nn;} 688 680 public: … … 709 701 710 702 class Edge { 711 //friend class NodeSet;712 //template <typename T> friend class EdgeMap;713 714 //template <typename T> friend class SymNodeSet::SymEdgeMap;715 //friend Edge SymNodeSet::opposite(Edge) const;716 717 // friend class Node;718 // friend class NodeIt;719 protected:720 //friend int NodeSet::id(Edge e) const;721 // Edge(int nn) {}722 703 public: 723 704 Edge() { } … … 726 707 bool operator!=(const Edge i) const {return false;} 727 708 bool operator<(const Edge i) const {return false;} 728 ///\bug This is a workaround until somebody tells me how to729 ///make class \c SymNodeSet::SymEdgeMap friend of Edge730 // int idref() {return 1;}731 // int idref() const {return 1;}732 709 }; 733 710 734 711 class EdgeIt : public Edge { 735 //friend class NodeSet;736 712 public: 737 713 EdgeIt(const NodeSet& G) : Edge() { } … … 739 715 EdgeIt (Invalid i) : Edge(i) { } 740 716 EdgeIt() : Edge() { } 741 ///\bug This is a workaround until somebody tells me how to742 ///make class \c SymNodeSet::SymEdgeMap friend of Edge743 // int idref() {return 1;}744 717 EdgeIt operator++() { return INVALID; } 745 718 }; … … 811 784 class Node : public NodeGraphType::Node { 812 785 friend class EdgeSet; 813 // template <typename T> friend class NodeMap;814 786 815 787 friend class Edge; … … 820 792 public: 821 793 friend int EdgeSet::id(Node v) const; 822 // Node(int nn) {n=nn;}823 794 public: 824 795 Node() : NodeGraphType::Node() {} … … 947 918 /// The ID of the \ref INVALID edge is 1. 948 919 ///\return The ID of the edge \c e. 949 int id(Edge e) const{ return e.n; }920 static int id(Edge e) { return e.n; } 950 921 951 922 /// Adds a new node to the graph. … … 1024 995 public: 1025 996 1026 // void erase(Node nn) {1027 // int n=nn.n;1028 // int m;1029 // while((m=nodes[n].first_in)!=1) eraseEdge(m);1030 // while((m=nodes[n].first_out)!=1) eraseEdge(m);1031 // }1032 1033 997 void erase(Edge e) { eraseEdge(e.n); } 1034 998 … … 1048 1012 friend class Node; 1049 1013 friend class NodeIt; 1050 public: 1051 ///\bug It should be at least protected 1052 /// 1014 protected: 1053 1015 int n; 1054 protected:1055 1016 friend int EdgeSet::id(Edge e) const; 1056 1017 … … 1062 1023 bool operator!=(const Edge i) const {return n!=i.n;} 1063 1024 bool operator<(const Edge i) const {return n<i.n;} 1064 ///\bug This is a workaround until somebody tells me how to1065 ///make class \c SymEdgeSet::SymEdgeMap friend of Edge1066 int &idref() {return n;}1067 const int &idref() const {return n;}1068 1025 }; 1069 1026 … … 1075 1032 public: 1076 1033 EdgeIt(const EdgeSet& _G) : Edge(), G(&_G) { 1077 // typename NodeGraphType::Node m;1078 1034 NodeIt m; 1079 1035 for(G>first(m); … … 1092 1048 return *this; 1093 1049 } 1094 ///\bug This is a workaround until somebody tells me how to1095 ///make class \c SymEdgeSet::SymEdgeMap friend of Edge1096 int &idref() {return this>n;}1097 1050 }; 1098 1051 
src/hugo/smart_graph.h
r904 r905 218 218 template <typename T> friend class EdgeMap; 219 219 220 //template <typename T> friend class SymSmartGraph::SymEdgeMap; 221 //friend Edge SymSmartGraph::opposite(Edge) const; 220 friend class SymSmartGraph; 222 221 223 222 friend class Node; … … 226 225 int n; 227 226 friend int SmartGraph::id(Edge e); 228 227 Edge(int nn) {n=nn;} 229 228 public: 230 229 /// An Edge with id \c n. 231 230 232 /// \bug It should be233 /// obtained by a member function of the Graph.234 Edge(int nn) {n=nn;}235 231 Edge() { } 236 232 Edge (Invalid) { n=1; } … … 238 234 bool operator!=(const Edge i) const {return n!=i.n;} 239 235 bool operator<(const Edge i) const {return n<i.n;} 240 ///\bug This is a workaround until somebody tells me how to241 ///make class \c SymSmartGraph::SymEdgeMap friend of Edge242 int &idref() {return n;}243 const int &idref() const {return n;}244 236 // ///Validity check 245 237 // operator bool() { return n!=1; } 238 239 ///Set the edge to that have ID \c ID. 240 void setToId(int id) { n=id; } 246 241 }; 247 242 … … 254 249 EdgeIt (Invalid i) : Edge(i) { } 255 250 EdgeIt() : Edge() { } 256 ///\bug This is a workaround until somebody tells me how to257 ///make class \c SymSmartGraph::SymEdgeMap friend of Edge258 int &idref() {return n;}259 251 EdgeIt &operator++() { n; return *this; } 260 252 // ///Validity check … … 343 335 { 344 336 Edge f; 345 f. idref() = e.idref()  2*(e.idref()%2) + 1;337 f.n = e.n  2*(e.n%2) + 1; 346 338 return f; 347 339 }
Note: See TracChangeset
for help on using the changeset viewer.