mirror of
https://github.com/boostorg/graph.git
synced 2026-01-31 08:12:14 +00:00
removed tabs
[SVN r7835]
This commit is contained in:
@@ -40,12 +40,12 @@ namespace boost {
|
||||
typedef typename std::vector<value_type>::size_type size_type;
|
||||
|
||||
bucket_sorter(size_type _length, bucket_type _max_bucket,
|
||||
const Bucket& _bucket = Bucket(), const ID& _id = ID())
|
||||
const Bucket& _bucket = Bucket(), const ID& _id = ID())
|
||||
: head(_max_bucket, invalid_value(size_type())),
|
||||
next(_length, invalid_value(value_type())),
|
||||
prev(_length, invalid_value(value_type())),
|
||||
id_to_value(_length),
|
||||
bucket(_bucket), id(_id) { }
|
||||
next(_length, invalid_value(value_type())),
|
||||
prev(_length, invalid_value(value_type())),
|
||||
id_to_value(_length),
|
||||
bucket(_bucket), id(_id) { }
|
||||
|
||||
void remove(const value_type& x) {
|
||||
const size_type i = id[x];
|
||||
@@ -54,12 +54,12 @@ namespace boost {
|
||||
|
||||
//check if i is the end of the bucket list
|
||||
if ( next_node != invalid_value(size_type()) )
|
||||
prev[next_node] = prev_node;
|
||||
prev[next_node] = prev_node;
|
||||
//check if i is the begin of the bucket list
|
||||
if ( prev_node != invalid_value(size_type()) )
|
||||
next[prev_node] = next_node;
|
||||
next[prev_node] = next_node;
|
||||
else //need update head of current bucket list
|
||||
head[ bucket[x] ] = next_node;
|
||||
head[ bucket[x] ] = next_node;
|
||||
}
|
||||
|
||||
void push(const value_type& x) {
|
||||
@@ -87,36 +87,36 @@ namespace boost {
|
||||
class stack {
|
||||
public:
|
||||
stack(bucket_type _bucket_id, Iter h, Iter n, Iter p, IterV v,
|
||||
const ID& _id = ID() )
|
||||
const ID& _id = ID() )
|
||||
: bucket_id(_bucket_id), head(h), next(n), prev(p), value(v), id(_id) {}
|
||||
|
||||
void push(const value_type& x) {
|
||||
const size_type new_head = id[x];
|
||||
const size_type current = head[bucket_id];
|
||||
if ( current != invalid_value(size_type()) )
|
||||
prev[current] = new_head;
|
||||
prev[new_head] = invalid_value(size_type());
|
||||
next[new_head] = current;
|
||||
head[bucket_id] = new_head;
|
||||
const size_type new_head = id[x];
|
||||
const size_type current = head[bucket_id];
|
||||
if ( current != invalid_value(size_type()) )
|
||||
prev[current] = new_head;
|
||||
prev[new_head] = invalid_value(size_type());
|
||||
next[new_head] = current;
|
||||
head[bucket_id] = new_head;
|
||||
}
|
||||
|
||||
void pop() {
|
||||
size_type current = head[bucket_id];
|
||||
size_type next_node = next[current];
|
||||
head[bucket_id] = next_node;
|
||||
if ( next_node != invalid_value(next_node) )
|
||||
prev[next_node] = invalid_value(next_node);
|
||||
size_type current = head[bucket_id];
|
||||
size_type next_node = next[current];
|
||||
head[bucket_id] = next_node;
|
||||
if ( next_node != invalid_value(next_node) )
|
||||
prev[next_node] = invalid_value(next_node);
|
||||
}
|
||||
|
||||
value_type& top() {
|
||||
return value[ head[bucket_id] ];
|
||||
return value[ head[bucket_id] ];
|
||||
}
|
||||
const value_type& top() const {
|
||||
return value[ head[bucket_id] ];
|
||||
return value[ head[bucket_id] ];
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
return head[bucket_id] == invalid_value(size_type());
|
||||
return head[bucket_id] == invalid_value(size_type());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -130,7 +130,7 @@ namespace boost {
|
||||
|
||||
stack operator[](const bucket_type& i) {
|
||||
return stack(i, head.begin(), next.begin(), prev.begin(),
|
||||
id_to_value.begin(), id );
|
||||
id_to_value.begin(), id );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace boost {
|
||||
|
||||
template <class AssociativeContainer, class T>
|
||||
void erase_dispatch(AssociativeContainer& c, const T& x,
|
||||
associative_container_tag)
|
||||
associative_container_tag)
|
||||
{
|
||||
c.erase(x);
|
||||
}
|
||||
|
||||
@@ -14,30 +14,30 @@ namespace boost {
|
||||
struct property_value_dispatch<1> {
|
||||
template <class Property, class T, class Tag>
|
||||
static T& get_value(Property& p, T, Tag) {
|
||||
return p.m_value;
|
||||
return p.m_value;
|
||||
}
|
||||
template <class Property, class T, class Tag>
|
||||
static const T& const_get_value(const Property& p, T, Tag) {
|
||||
return p.m_value;
|
||||
return p.m_value;
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct property_value_dispatch<0> {
|
||||
template <class Property, class T, class Tag>
|
||||
static T& get_value(Property& p, T t, Tag tag) {
|
||||
typedef typename Property::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = int(Next_tag::num) == int(Tag::num) };
|
||||
return property_value_dispatch<match>
|
||||
::get_value(static_cast<Next&>(p), t, tag);
|
||||
typedef typename Property::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = int(Next_tag::num) == int(Tag::num) };
|
||||
return property_value_dispatch<match>
|
||||
::get_value(static_cast<Next&>(p), t, tag);
|
||||
}
|
||||
template <class Property, class T, class Tag>
|
||||
static const T& const_get_value(const Property& p, T t, Tag tag) {
|
||||
typedef typename Property::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = int(Next_tag::num) == int(Tag::num) };
|
||||
return property_value_dispatch<match>
|
||||
::const_get_value(static_cast<const Next&>(p), t, tag);
|
||||
typedef typename Property::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = int(Next_tag::num) == int(Tag::num) };
|
||||
return property_value_dispatch<match>
|
||||
::const_get_value(static_cast<const Next&>(p), t, tag);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -90,22 +90,22 @@ namespace boost {
|
||||
struct recursive_extract {
|
||||
template <class TagValueAList, class Tag1>
|
||||
struct bind {
|
||||
typedef typename TagValueAList::first_type AListFirst;
|
||||
typedef typename AListFirst::first_type Tag2;
|
||||
typedef typename AListFirst::second_type Value;
|
||||
enum { tag1 = Tag1::num, tag2 = Tag2::num };
|
||||
typedef typename TagValueAList::first_type AListFirst;
|
||||
typedef typename AListFirst::first_type Tag2;
|
||||
typedef typename AListFirst::second_type Value;
|
||||
enum { tag1 = Tag1::num, tag2 = Tag2::num };
|
||||
|
||||
typedef typename TagValueAList::second_type Next;
|
||||
typedef typename ev_selector<Next>::type Extractor;
|
||||
typedef typename boost::ct_if< tag1==tag2, Value,
|
||||
typename Extractor::template bind<Next,Tag1>::type
|
||||
>::type type;
|
||||
typedef typename TagValueAList::second_type Next;
|
||||
typedef typename ev_selector<Next>::type Extractor;
|
||||
typedef typename boost::ct_if< tag1==tag2, Value,
|
||||
typename Extractor::template bind<Next,Tag1>::type
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
struct end_extract {
|
||||
template <class AList, class Tag1>
|
||||
struct bind {
|
||||
typedef error_property_not_found type;
|
||||
typedef error_property_not_found type;
|
||||
};
|
||||
};
|
||||
#endif //!defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
@@ -34,8 +34,8 @@ protected:
|
||||
public:
|
||||
|
||||
fibonacci_heap(size_type n,
|
||||
const Compare& cmp,
|
||||
const ID& id = identity_property_map())
|
||||
const Compare& cmp,
|
||||
const ID& id = identity_property_map())
|
||||
: _key(n), _left(n), _right(n), _p(n), _mark(n), _degree(n),
|
||||
_n(0), _root(n), _id(id), _compare(cmp), _child(n),
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
@@ -75,45 +75,45 @@ public:
|
||||
if (_degree[_root] == 0) {
|
||||
v = _right[_root];
|
||||
} else {
|
||||
w = _child[_root];
|
||||
v = _right[w];
|
||||
_right[w] = _right[_root];
|
||||
for (w = v; w != _right[_root]; w = _right[w])
|
||||
_p[w] = nil();
|
||||
w = _child[_root];
|
||||
v = _right[w];
|
||||
_right[w] = _right[_root];
|
||||
for (w = v; w != _right[_root]; w = _right[w])
|
||||
_p[w] = nil();
|
||||
}
|
||||
while (v != _root) {
|
||||
w = _right[v];
|
||||
add_tree_to_new_roots(v, new_roots.begin(), h);
|
||||
v = w;
|
||||
w = _right[v];
|
||||
add_tree_to_new_roots(v, new_roots.begin(), h);
|
||||
v = w;
|
||||
}
|
||||
rebuild_root_list(new_roots.begin(), h);
|
||||
}
|
||||
}
|
||||
// 39
|
||||
inline void add_tree_to_new_roots(size_type v,
|
||||
LinkIter new_roots,
|
||||
int& h)
|
||||
LinkIter new_roots,
|
||||
int& h)
|
||||
{
|
||||
int r;
|
||||
size_type u;
|
||||
r = _degree[v];
|
||||
while (1) {
|
||||
if (h < r) {
|
||||
do {
|
||||
++h;
|
||||
new_roots[h] = (h == r ? v : nil());
|
||||
} while (h < r);
|
||||
break;
|
||||
do {
|
||||
++h;
|
||||
new_roots[h] = (h == r ? v : nil());
|
||||
} while (h < r);
|
||||
break;
|
||||
}
|
||||
if (new_roots[r] == nil()) {
|
||||
new_roots[r] = v;
|
||||
break;
|
||||
new_roots[r] = v;
|
||||
break;
|
||||
}
|
||||
u = new_roots[r];
|
||||
new_roots[r] = nil();
|
||||
if (_compare(_key[u], _key[v])) {
|
||||
_degree[v] = r;
|
||||
std::swap(u, v);
|
||||
_degree[v] = r;
|
||||
std::swap(u, v);
|
||||
}
|
||||
make_child(u, v, r);
|
||||
++r;
|
||||
@@ -147,15 +147,15 @@ public:
|
||||
_root = u;
|
||||
for (h--; h >= 0; --h)
|
||||
if (new_roots[h] != nil()) {
|
||||
w = new_roots[h];
|
||||
_left[w] = v;
|
||||
_right[v] = w;
|
||||
if (_compare(_key[w], d)) {
|
||||
_root = w;
|
||||
d = _key[w];
|
||||
}
|
||||
v = w;
|
||||
}
|
||||
w = new_roots[h];
|
||||
_left[w] = v;
|
||||
_right[v] = w;
|
||||
if (_compare(_key[w], d)) {
|
||||
_root = w;
|
||||
d = _key[w];
|
||||
}
|
||||
v = w;
|
||||
}
|
||||
_right[v] = u;
|
||||
_left[u] = v;
|
||||
}
|
||||
@@ -172,22 +172,22 @@ public:
|
||||
_root = v;
|
||||
} else if (_compare(d, _key[_root]))
|
||||
while (1) {
|
||||
size_type r = _degree[p];
|
||||
if (r >= 2)
|
||||
remove_from_family(v, p);
|
||||
insert_into_forest(v, d);
|
||||
size_type pp = _p[p];
|
||||
if (pp == nil()) {
|
||||
--_degree[p];
|
||||
break;
|
||||
}
|
||||
if (_mark[p] == false) {
|
||||
_mark[p] = true;
|
||||
break;
|
||||
} else
|
||||
--_degree[p];
|
||||
v = p;
|
||||
p = pp;
|
||||
size_type r = _degree[p];
|
||||
if (r >= 2)
|
||||
remove_from_family(v, p);
|
||||
insert_into_forest(v, d);
|
||||
size_type pp = _p[p];
|
||||
if (pp == nil()) {
|
||||
--_degree[p];
|
||||
break;
|
||||
}
|
||||
if (_mark[p] == false) {
|
||||
_mark[p] = true;
|
||||
break;
|
||||
} else
|
||||
--_degree[p];
|
||||
v = p;
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,8 +199,8 @@ public:
|
||||
size_type i = _root;
|
||||
do {
|
||||
print_recur(i, os);
|
||||
os << endl;
|
||||
i = _right[i];
|
||||
os << endl;
|
||||
i = _right[i];
|
||||
} while (i != _root);
|
||||
}
|
||||
}
|
||||
@@ -230,13 +230,13 @@ protected:
|
||||
if (x != nil()) {
|
||||
os << x;
|
||||
if (_child[x] != nil()) {
|
||||
os << "(";
|
||||
size_type i = _child[x];
|
||||
do {
|
||||
print_recur(i, os); os << " ";
|
||||
i = _right[i];
|
||||
} while (i != _child[x]);
|
||||
os << ")";
|
||||
os << "(";
|
||||
size_type i = _child[x];
|
||||
do {
|
||||
print_recur(i, os); os << " ";
|
||||
i = _right[i];
|
||||
} while (i != _child[x]);
|
||||
os << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ namespace boost {
|
||||
}
|
||||
template <class InputIterator>
|
||||
mutable_queue(InputIterator first, InputIterator last,
|
||||
const Comp& x, const ID& _id)
|
||||
const Comp& x, const ID& _id)
|
||||
: index_array(last-first), c(first, last), comp(x), id(_id)
|
||||
{
|
||||
while( first != last ) {
|
||||
push(*first);
|
||||
++first;
|
||||
push(*first);
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user