Commit a7c4fc32 authored by Asal Asgari's avatar Asal Asgari
Browse files

BFS Finished Code all unit tests passed! :D

parent f9252487
......@@ -19,55 +19,35 @@ namespace dte3603::graph::algorithms
typename Graph_T::vertex_descriptor const& start)
/* Bost Graph-concept type container API
* For Adjacency list api examples see:
// Given vertice descriptor u
using VertexDescriptor = typename Graph_T::vertex_descriptor;
auto const u = VertexDescriptor();
// Access adjacent connected vertices [descriptors]
[[maybe_unused]]auto const adj_verts = boost::adjacent_vertices(u, graph);
// In and out edges [descriptors]
[[maybe_unused]]auto const in_edges = boost::in_edges(u, graph);
[[maybe_unused]]auto const out_edges = boost::out_edges(u, graph);
// Given edge descriptor e
using EdgeDescriptor = typename Graph_T::edge_descriptor;
auto const e = EdgeDescriptor();
// Source and target vertices from edge [descriptors]
[[maybe_unused]]auto const s = boost::source(e, graph);
[[maybe_unused]]auto const t = boost::source(e, graph);
// Given properties [vertexProperty].name and [edgeProperty].distance
// Access bundled vertex and edge properties from descriptors
[[maybe_unused]]auto const& vert_name = graph[u].name;
[[maybe_unused]]auto const& edge_length = graph[e].distance;
// Access vertices or edges [iterators]
auto [v_itr_begin, v_itr_end] = boost::vertices(graph);
auto [e_itr_begin, e_itr_end] = boost::edges(graph);
// Iterate over vertices and edges and
// Access descriptor and properties from said iterators
for(/**/; v_itr_begin != v_itr_end; ++v_itr_begin) {
auto const vi = v_itr_begin;
auto const v1 = *vi;
[[maybe_unused]]auto const& v1_name = graph[v1].name;
using VertexDescriptor = typename Graph_T::vertex_descriptor;
auto u = VertexDescriptor();
boost::adjacency_list<>::vertex_iterator> vs = boost::vertices(graph);
u = NodeQ.front();
auto adj_verts = boost::adjacent_vertices(u, graph);
for(auto i=adj_verts.first; i != adj_verts.second; ++i) {
auto const vi = *(i);
if(!(std::find(visited.begin(), visited.end(), vi) != visited.end())){
for(/**/; e_itr_begin != e_itr_end; ++e_itr_begin) {
auto const ei = e_itr_begin;
auto const e1 = *ei;
[[maybe_unused]]auto const& e1_length = graph[e1].distance;
return {};
return Nodes;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment