lemon/hypercube_graph.h
changeset 2386 81b47fc5c444
parent 2260 4274224f8a7d
child 2391 14a343be7a5a
equal deleted inserted replaced
17:cabd32da4ceb 18:16a17d41e5a1
   152     int dimension() const {
   152     int dimension() const {
   153       return _dim;
   153       return _dim;
   154     }
   154     }
   155 
   155 
   156     bool projection(Node node, int n) const {
   156     bool projection(Node node, int n) const {
   157       return (bool)(node.id & (1 << n));
   157       return static_cast<bool>(node.id & (1 << n));
   158     }
   158     }
   159 
   159 
   160     int dimension(Edge edge) const {
   160     int dimension(Edge edge) const {
   161       return edge.id % _dim;
   161       return edge.id % _dim;
   162     }
   162     }
   163 
   163 
   164     int index(Node node) const {
   164     int index(Node node) const {
   165       return node.id;
   165       return node.id;
   166     }
   166     }
   167 
   167 
   168     Node operator()(int index) const {
   168     Node operator()(int ix) const {
   169       return Node(index);
   169       return Node(ix);
   170     }
   170     }
   171     
   171     
   172   private:
   172   private:
   173     int _dim, _nodeNum;
   173     int _dim, _nodeNum;
   174   };
   174   };
   234     }
   234     }
   235 
   235 
   236     /// \brief Gives back the node by its index.
   236     /// \brief Gives back the node by its index.
   237     ///
   237     ///
   238     /// Gives back the node by its index.
   238     /// Gives back the node by its index.
   239     Node operator()(int index) const {
   239     Node operator()(int ix) const {
   240       return Parent::operator()(index);
   240       return Parent::operator()(ix);
   241     }
   241     }
   242 
   242 
   243     /// \brief Number of nodes.
   243     /// \brief Number of nodes.
   244     int nodeNum() const { return Parent::nodeNum(); }
   244     int nodeNum() const { return Parent::nodeNum(); }
   245     /// \brief Number of edges.
   245     /// \brief Number of edges.