58 template<
class NodeData>
74 inline const std::set<Node*>&
80 inline const NodeData&
133 for (
auto nit =
nodes_.begin () ; nit !=
nodes_.end () ; ++nit )
146 for (
auto nit =
nodes_.begin () ; nit !=
nodes_.end () ; ++nit )
149 nodes_.resize (
static_cast<std::size_t
> (n));
151 for (
int i = 0 ; i < n ; ++i )
158 std::vector<Node*> sorted_nodes (
nodes_.size ());
162 for (
auto it =
nodes_.begin () ; it !=
nodes_.end () ; ++it )
164 sorted_nodes[i++] = *it;
169 std::sort (sorted_nodes.begin (), sorted_nodes.end (),
Node::compare);
172 for (
auto it = sorted_nodes.begin () ; it != sorted_nodes.end () ; ++it )
182 for (
auto neigh = (*it)->neighbors_.begin () ; neigh != (*it)->neighbors_.end () ; ++neigh )
185 off_nodes.push_back (*neigh);
189 on_nodes.push_back (*it);
219 inline typename std::vector<Node*>&
const NodeData & getData() const
const std::set< Node * > & getNeighbors() const
std::set< Node * > neighbors_
void setData(const NodeData &data)
void setFitness(int fitness)
static bool compare(const Node *a, const Node *b)
void computeMaximalOnOffPartition(std::list< Node * > &on_nodes, std::list< Node * > &off_nodes)
void resize(int n)
Drops all existing graph nodes and creates 'n' new ones.
std::vector< Node * > nodes_
void insertDirectedEdge(int id1, int id2)
void deleteUndirectedEdge(int id1, int id2)
void insertUndirectedEdge(int id1, int id2)
std::vector< Node * > & getNodes()
void deleteDirectedEdge(int id1, int id2)