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:
-
| g | The network |
| vertices | The vertex map |
| id | Vertex 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:
-
| g | The network |
| vertices | Boost vertex map for the network |
| fr | An endpoint of the edge |
| to | The 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:
-
| g | The network |
| v | Set of vertices to print |
| out | File to print to |
| density | Density 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:
-
| g | The network |
| v | Set of vertices to print |
| out | File to print to |
| density | Density of the set of vertices |
| ID | VertexID to original name mapping |
| delim | Character 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:
-
| g | The network |
| vertices | The boost vertex map |
| id | Original vertex name to ID map |
| in | Stream to read network from |
| alpha | factor for positive edges |
| beta | factor for negative edges |
| weightThresh | Minimum Edge Weight |
| delimiter | Network file delimiters |
Get the maximum weight absolute value to normalize all edge weights (helps normalize the second part of complex density calculation)