GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::vertex_set Class Reference

Describes a set of vertices. More...

#include <graphlab/graph/vertex_set.hpp>

List of all members.

Public Member Functions

 vertex_set ()
 default constructor which constructs an empty set.
 vertex_set (bool complete)
 vertex_set (const vertex_set &other)
 copy constructor
vertex_setoperator= (const vertex_set &other)
 copyable
bool l_contains (lvid_type lvid) const
vertex_set operator& (const vertex_set &other) const
 Takes the set intersection of two vertex sets.
vertex_set operator| (const vertex_set &other) const
 Takes the set union of two vertex sets.
vertex_set operator- (const vertex_set &other) const
 Takes the set difference of two vertex sets.
vertex_setoperator&= (const vertex_set &other)
 Takes the set intersection of the current vertex set with another vertex set.
vertex_setoperator|= (const vertex_set &other)
 Takes the set union of the current vertex set with another vertex set.
vertex_setoperator-= (const vertex_set &other)
 Takes the set difference of the current vertex set with another vertex set.
vertex_set operator~ () const
 Returns the inverse of the current set.
void invert ()
 Inverts the current set in-place.

Detailed Description

Describes a set of vertices.

The vertex_set describes a set of vertices upon which union / intersection / difference can be performed. These sets can then be passed into graph aggregate operations such as distributed_graph::map_reduce_vertices to perform aggregates over subsets of vertices or edges. Engines also permit signalling of sets of vertices through signal_all().

distributed_graph::complete_set() and distributed_graph::empty_set() provide two convenient functions to obtain a full or an empty set of vertices.

vertex_set all = graph.complete_set();
vertex_set empty = graph.empty_set();

distributed_graph::select() can be used to obtain a restriction of the set of vertices. For instance if vertices contain an integer, the following code will construct a set of vertices containing only vertices with data which are a multiple of 2.

bool is_multiple_of_2(const graph_type::vertex_type& vertex) {
return vertex.data() % 2 == 0;
}
vertex_set even_vertices = graph.select(is_multiple_of_2);

For more details see distributed_graph::select()

The size of the vertex set can only be queried through the graph using distributed_graph::vertex_set_size();

Definition at line 71 of file vertex_set.hpp.


Constructor & Destructor Documentation

graphlab::vertex_set::vertex_set ( bool  complete)
inlineexplicit

Constructs a completely empty, or a completely full vertex set

Parameters:
completeIf set to true, creates a set of all vertices. If set to false, creates an empty set.

Definition at line 234 of file vertex_set.hpp.


Member Function Documentation

void graphlab::vertex_set::invert ( )
inline

Inverts the current set in-place.

b.invert();

A vertex is in the result b if and only if it is not in b

Definition at line 421 of file vertex_set.hpp.

vertex_set graphlab::vertex_set::operator& ( const vertex_set other) const
inline

Takes the set intersection of two vertex sets.

vertex_set intersection_result = a & b;

A vertex is in intersection_result if and only if the vertex is in both set a and set b.

Definition at line 273 of file vertex_set.hpp.

vertex_set& graphlab::vertex_set::operator&= ( const vertex_set other)
inline

Takes the set intersection of the current vertex set with another vertex set.

a &= b;

A vertex is in the resultant a if and only if the vertex was in both set a and set b.

Definition at line 329 of file vertex_set.hpp.

vertex_set graphlab::vertex_set::operator- ( const vertex_set other) const
inline

Takes the set difference of two vertex sets.

vertex_set difference_result = a - b;

A vertex is in difference_result if and only if the vertex is in set a and not in set b.

Equivalent to:

vertex_set inv_b = ~b;
vertex_set difference_result = a & inv_b;

Definition at line 312 of file vertex_set.hpp.

vertex_set& graphlab::vertex_set::operator-= ( const vertex_set other)
inline

Takes the set difference of the current vertex set with another vertex set.

a -= b;

A vertex is in the resultant a if and only if the vertex was in set a but not in set b.

Conceptually equivalent to

a &= ~b;

Definition at line 384 of file vertex_set.hpp.

vertex_set graphlab::vertex_set::operator| ( const vertex_set other) const
inline

Takes the set union of two vertex sets.

vertex_set union_result = a | b;

A vertex is in union_result if and only if the vertex is in either of set a and set b.

Definition at line 289 of file vertex_set.hpp.

vertex_set& graphlab::vertex_set::operator|= ( const vertex_set other)
inline

Takes the set union of the current vertex set with another vertex set.

a |= b;

A vertex is in the resultant a if and only if the vertex was in either set a and set b.

Definition at line 354 of file vertex_set.hpp.

vertex_set graphlab::vertex_set::operator~ ( ) const
inline

Returns the inverse of the current set.

vertex_set inv_b = ~b;

A vertex is in inv_b if and only if it is not in b

Definition at line 407 of file vertex_set.hpp.


The documentation for this class was generated from the following file: