This class implements a special graph type. The nodes of the graph are indiced with integers with at most dim
binary digits. Two nodes are connected in the graph if and only if their indices differ only on one position in the binary form.
int
for efficiency reasons. Thus the maximum dimension of this implementation is 26 (assuming that the size of int
is 32 bit).This graph type fully conforms to the Graph concept.
#include <lemon/hypercube_graph.h>
Inherits GraphExtender< Base >.
Classes | |
class | HyperMap |
Linear combination map. More... | |
Public Member Functions | |
HypercubeGraph (int dim) | |
int | dimension () const |
The number of dimensions. | |
bool | projection (Node node, int n) const |
int | dimension (Edge edge) const |
The dimension id of an edge. | |
int | dimension (Arc arc) const |
The dimension id of an arc. | |
int | index (Node node) const |
The index of a node. | |
Node | operator() (int ix) const |
int | nodeNum () const |
Number of nodes. | |
int | edgeNum () const |
Number of edges. | |
int | arcNum () const |
Number of arcs. | |
|
inline |
Constructs a hypercube graph with dim
dimensions.
|
inline |
Gives back the number of dimensions.
|
inline |
Returns true
if the n'th bit of the node is one.
|
inline |
Gives back the dimension id of the given edge. It is in the [0..dim-1] range.
|
inline |
Gives back the dimension id of the given arc. It is in the [0..dim-1] range.
|
inline |
Gives back the index of the given node. The lower bits of the integer describes the node.
|
inline |
Gives back a node by its index.