I noticed that in Graph problems,
book suddenly started using traditional pointers instead of shared_ptr.
Is there a reason for doing this? Does it make the solution anyway simpler or optimized when it comes to graphs?
e.g.
struct GraphVertex
{
vector<GraphVertex*> edges;
};
instead of
struct GraphVertex
{
vector< shared_ptr<GraphVertex>> edges;
};
Also normally arguments to functions are passed by c++ style reference in the entire book but not in Graphs chapter.
e.g.
bool do_something(vector<GraphVertex>* G)
{
// func def
}
instead of
bool do_something(vector<GraphVertex> &G)
{
// func def
}
What am I missing?