Empirical
Public Member Functions | Protected Attributes | List of all members
emp::WeightedGraph Class Reference

#include <Graph.h>

Inheritance diagram for emp::WeightedGraph:
emp::Graph

Public Member Functions

 WeightedGraph (size_t num_nodes=0)
 
 WeightedGraph (const WeightedGraph &)=default
 Copy constructor. More...
 
 WeightedGraph (WeightedGraph &&)=default
 Move constructor. More...
 
 ~WeightedGraph ()
 
WeightedGraphoperator= (const WeightedGraph &)=default
 Copy operator. More...
 
WeightedGraphoperator= (WeightedGraph &&)=default
 Move operator. More...
 
void Resize (size_t new_size)
 
double GetWeight (size_t from, size_t to) const
 Determine weight of a specific edge in this graph. More...
 
void AddEdge (size_t from, size_t to, double weight)
 When Adding an edge, must also provide a weight. More...
 
void AddEdgePair (size_t from, size_t to, double weight)
 When Adding an edge pair, must also provide a weight. More...
 
void Merge (const WeightedGraph &in_graph)
 Merge two WeightedGraphs into one. More...
 
void PrintSym (std::ostream &os=std::cout)
 Print a symmetric graph to the provided output stream (defaulting to standard out) More...
 
void PrintDirected (std::ostream &os=std::cout)
 Print a directed graph to the provided output stream (defaulting to standard out) More...
 
size_t GetSize () const
 Get number of vertices in this graph. More...
 
size_t GetEdgeCount () const
 Get the total number of edges in this graph. More...
 
const BitVectorGetEdgeSet (size_t id) const
 Get the set of nodes that a specified node is connected to. More...
 
size_t GetDegree (size_t id) const
 Get the degree of a specified node. More...
 
size_t GetMaskedDegree (size_t id, const BitVector &mask) const
 Get how many of a set of nodes that a specified node is connected to. More...
 
bool HasEdge (size_t from, size_t to) const
 Determine if a specific edge is included in this graph. More...
 
void AddEdge (size_t from, size_t to)
 Add a specified edge into this graph. More...
 
void RemoveEdge (size_t from, size_t to)
 Remove a specified edge from this graph. More...
 
void SetEdge (size_t from, size_t to, bool val)
 Set the status of a specified edge as to whether or not it should be in the graph. More...
 
bool HasEdgePair (size_t from, size_t to) const
 Determine if edges exist in both directions between a pair of vertices. More...
 
void AddEdgePair (size_t from, size_t to)
 Add a pair of edges between two vertieces (in both directions) More...
 
void RemoveEdgePair (size_t from, size_t to)
 Remove edges in both directions between a pair of vertices. More...
 
void SetEdgePairs (size_t from, size_t to, bool val)
 Set the status as to whether a pair of edges (in both direction) exist. More...
 
void Merge (const Graph &in_graph)
 Merge a second graph into this one. More...
 

Protected Attributes

emp::vector< emp::vector< double > > weights
 
emp::vector< Nodenodes
 Set of vertices in this graph. More...
 

Constructor & Destructor Documentation

emp::WeightedGraph::WeightedGraph ( size_t  num_nodes = 0)
inline
emp::WeightedGraph::WeightedGraph ( const WeightedGraph )
default

Copy constructor.

emp::WeightedGraph::WeightedGraph ( WeightedGraph &&  )
default

Move constructor.

emp::WeightedGraph::~WeightedGraph ( )
inline

Member Function Documentation

void emp::Graph::AddEdge ( size_t  from,
size_t  to 
)
inlineinherited

Add a specified edge into this graph.

void emp::WeightedGraph::AddEdge ( size_t  from,
size_t  to,
double  weight 
)
inline

When Adding an edge, must also provide a weight.

void emp::Graph::AddEdgePair ( size_t  from,
size_t  to 
)
inlineinherited

Add a pair of edges between two vertieces (in both directions)

void emp::WeightedGraph::AddEdgePair ( size_t  from,
size_t  to,
double  weight 
)
inline

When Adding an edge pair, must also provide a weight.

size_t emp::Graph::GetDegree ( size_t  id) const
inlineinherited

Get the degree of a specified node.

size_t emp::Graph::GetEdgeCount ( ) const
inlineinherited

Get the total number of edges in this graph.

const BitVector& emp::Graph::GetEdgeSet ( size_t  id) const
inlineinherited

Get the set of nodes that a specified node is connected to.

size_t emp::Graph::GetMaskedDegree ( size_t  id,
const BitVector mask 
) const
inlineinherited

Get how many of a set of nodes that a specified node is connected to.

size_t emp::Graph::GetSize ( ) const
inlineinherited

Get number of vertices in this graph.

double emp::WeightedGraph::GetWeight ( size_t  from,
size_t  to 
) const
inline

Determine weight of a specific edge in this graph.

bool emp::Graph::HasEdge ( size_t  from,
size_t  to 
) const
inlineinherited

Determine if a specific edge is included in this graph.

bool emp::Graph::HasEdgePair ( size_t  from,
size_t  to 
) const
inlineinherited

Determine if edges exist in both directions between a pair of vertices.

void emp::Graph::Merge ( const Graph in_graph)
inlineinherited

Merge a second graph into this one.

void emp::WeightedGraph::Merge ( const WeightedGraph in_graph)
inline

Merge two WeightedGraphs into one.

WeightedGraph& emp::WeightedGraph::operator= ( const WeightedGraph )
default

Copy operator.

WeightedGraph& emp::WeightedGraph::operator= ( WeightedGraph &&  )
default

Move operator.

void emp::WeightedGraph::PrintDirected ( std::ostream &  os = std::cout)
inline

Print a directed graph to the provided output stream (defaulting to standard out)

void emp::WeightedGraph::PrintSym ( std::ostream &  os = std::cout)
inline

Print a symmetric graph to the provided output stream (defaulting to standard out)

void emp::Graph::RemoveEdge ( size_t  from,
size_t  to 
)
inlineinherited

Remove a specified edge from this graph.

void emp::Graph::RemoveEdgePair ( size_t  from,
size_t  to 
)
inlineinherited

Remove edges in both directions between a pair of vertices.

void emp::WeightedGraph::Resize ( size_t  new_size)
inline
void emp::Graph::SetEdge ( size_t  from,
size_t  to,
bool  val 
)
inlineinherited

Set the status of a specified edge as to whether or not it should be in the graph.

void emp::Graph::SetEdgePairs ( size_t  from,
size_t  to,
bool  val 
)
inlineinherited

Set the status as to whether a pair of edges (in both direction) exist.

Member Data Documentation

emp::vector<Node> emp::Graph::nodes
protectedinherited

Set of vertices in this graph.

emp::vector< emp::vector< double > > emp::WeightedGraph::weights
protected

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