My Project
Classes | Functions
graph.h File Reference

Boost network helper structures. More...

#include "MyTools.h"
#include <iostream>
#include <map>
#include <vector>
#include <boost/graph/adjacency_list.hpp>
#include "types.h"

Go to the source code of this file.

Classes

struct  undirected_t
 Undirected Networks. More...
struct  directed_t
 Directed Networks. More...
struct  bidirected_t
 Directed Network With Cycles of Size 2. More...

Functions

template<typename graph_t >
graph_t::vertex add_or_get_vertex (typename graph_t::graph &g, typename graph_t::map &vertices, lui id)
 Retrieves a vertex from the network.
template<typename graph_t >
void bump_edge (typename graph_t::graph &g, typename graph_t::map &vertices, typename graph_t::vertex_name_t fr, typename graph_t::vertex_name_t to)
template<typename graph_t >
void read_from_stream (typename graph_t::graph &g, typename graph_t::map &vertices, map< string, lui > &id, std::ifstream &in, double alpha, double beta, double weightThresh, string delimiter)
template<typename graph_t >
void print_set (const typename graph_t::graph &g, const std::set< typename graph_t::vertex > &v, std::ostream &out, float density)
template<typename graph_t >
void print_set_trans (const typename graph_t::graph &g, const std::set< typename graph_t::vertex > &v, std::ostream &out, float density, map< string, lui > ID, char delim)

Detailed Description

Boost network helper structures.


Function Documentation

template<typename graph_t >
typename graph_t::vertex add_or_get_vertex ( typename graph_t::graph &  g,
typename graph_t::map &  vertices,
lui  id 
)

Retrieves a vertex from the network.

Converts from regular vertex ID to boost vertex structure. Adds the vertex into the network if it's not already there.

Parameters:
gThe network
verticesThe vertex map
idVertex to retrieve
Returns:
Boost vertex corresponding to given vertex ID
template<typename graph_t >
void bump_edge ( typename graph_t::graph &  g,
typename graph_t::map &  vertices,
typename graph_t::vertex_name_t  fr,
typename graph_t::vertex_name_t  to 
)

A function to bump the weight of an edge or create and set it to 1.

Parameters:
gThe network
verticesBoost vertex map for the network
frAn endpoint of the edge
toThe other endpoint
template<typename graph_t >
void print_set ( const typename graph_t::graph &  g,
const std::set< typename graph_t::vertex > &  v,
std::ostream &  out,
float  density 
)

Print a line for the set of vertices. Use the vertex_name as labels.

Parameters:
gThe network
vSet of vertices to print
outFile to print to
densityDensity of the set of vertices
template<typename graph_t >
void print_set_trans ( const typename graph_t::graph &  g,
const std::set< typename graph_t::vertex > &  v,
std::ostream &  out,
float  density,
map< string, lui ID,
char  delim 
)

Print a line for the set of vertices using the original vertex identifiers

Parameters:
gThe network
vSet of vertices to print
outFile to print to
densityDensity of the set of vertices
IDVertexID to original name mapping
delimCharacter to put between vertex names in results file.
template<typename graph_t >
void read_from_stream ( typename graph_t::graph &  g,
typename graph_t::map &  vertices,
map< string, lui > &  id,
std::ifstream &  in,
double  alpha = 1,
double  beta = 1,
double  weightThresh = 0,
string  delimiter = "\t," 
)

Add edges to the graph according the the (fr, to, wt) triples in the file.

Parameters:
gThe network
verticesThe boost vertex map
idOriginal vertex name to ID map
inStream to read network from
alphafactor for positive edges
betafactor for negative edges
weightThreshMinimum Edge Weight
delimiterNetwork file delimiters

Get the maximum weight absolute value to normalize all edge weights (helps normalize the second part of complex density calculation)

 All Classes Files Functions Variables Typedefs