Examples on how to use graph::Graph class.
void build_undirected_unweighted_graph() {
int count = 100;
for (int i = 0; i < count; ++i) {
}
for (int i = 0; i < count-1; ++i) {
}
for (int i = 0; i < count-1; ++i) {
EXPECT_TRUE(graph.
IsEdge(i, i+1));
EXPECT_TRUE(graph.IsEdge(i+1, i));
}
}
void build_directed_unweighted_graph() {
int count = 100;
for (int i = 0; i < count; ++i) {
graph.AddNode(i);
}
for (int i = 0; i < count-1; ++i) {
graph.AddEdge(i, i+1);
}
for (int i = 0; i < count-1; ++i) {
EXPECT_TRUE(graph.IsEdge(i, i+1));
}
}
void build_undirected_weighted_graph() {
int count = 100;
for (int i = 0; i < count; ++i) {
graph.AddNode(i);
}
for (int i = 0; i < count-1; ++i) {
graph.AddEdge(i, i+1, i);
}
for (int i = 0; i < count-1; ++i)
{
EXPECT_TRUE(graph.IsEdge(i, i+1));
EXPECT_TRUE(graph.IsEdge(i+1, i));
std::pair<bool, EdgeWeight> res = graph.
GetEdgeWeight(i, i+1);
EXPECT_TRUE(res.first);
EXPECT_EQ(res.second, i);
std::pair<bool, EdgeWeight> res1 = graph.GetEdgeWeight(i+1, i);
EXPECT_TRUE(res1.first);
EXPECT_EQ(res1.second, i);
}
}
void load_graph_from_dir() {
std::string path = "some path to dir";
}
for (T::TNodeI nodeItr = graph->
BegNI(); nodeItr != graph->
EndNI() ; nodeItr++ ){
int node_id = nodeItr.GetId();
}
}