All Distance Sketch  0.1
All distance sketch based algorithms
Public Member Functions | List of all members
all_distance_sketch::graph::Graph< T > Class Template Reference

Graph data structure Thin wrapper over SNAP graph. More...

#include <graph.h>

Public Member Functions

int AddNode (int node_id)
 
int AddEdge (const int &aSrcNId, const int &aDstNId, int weight=1)
 
std::pair< bool, EdgeWeight > GetEdgeWeight (const int &aSrcNId, const int &aDstNId)
 
TEdgesWeights * GetNodeWeights (int aNode)
 
T::TNodeI BegNI ()
 
T::TNodeI EndNI ()
 
bool IsEdge (const int &aSrcNId, const int &aDstNId) const
 
bool IsNode (const int &node_id) const
 
int GetNumNodes () const
 
int GetNumEdges () const
 
T::TNodeI GetNI (const int &node_id) const
 
int GetMxNId () const
 
void Transpose (Graph< T > *transpose)
 Changes the direction of all edges For undirected graph this has no effect.
 
void LoadGraphFromDir (std::string aPath, bool aTranspose=false)
 Loads the graph from files located in a dir. More...
 

Detailed Description

template<class T>
class all_distance_sketch::graph::Graph< T >

Graph data structure Thin wrapper over SNAP graph.

Examples:
examples/graph.cpp, examples/reverse_rank.cpp, examples/sketch.cpp, and examples/t_skim.cpp.

Member Function Documentation

template<class T>
void all_distance_sketch::graph::Graph< T >::LoadGraphFromDir ( std::string  aPath,
bool  aTranspose = false 
)
inline

Loads the graph from files located in a dir.

Parameters
[in]aPath- path to dir. The directory should contain a file with .txt suffix that contains pairs of nodes in each line indicating an edge between the nodes, e.g.

1 2

1 268635

The above example will create the nodes 1, 2, 268635 and edges (1, 2) and (1, 26835) If you have nodes that have no edges to other nodes then insert them manually.

Parameters
[in]aTranspose- should load the graph with reverse edges. If set to True the above example will insert (2, 1) and (268635, 1).

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