Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Saturday, November 9, 2013
Chapter 3 is done
This chapter is about Graph computation and there are classical algorithms (BFS, DFS, MST). MST is implementing the classical Prim's algo but using Fibonacci heap available in Boost. Here you find the first version of the graph code
Quick inspection, no idea if this is what you want, if this is the right direction there is still something to do
- between two vertex can exist more than 1 edge ? If not then the code must be improved - Graph can inherit from a map and avoid to export via getNodes() the internal structure - Constness - replaced post increments with pre increment where possible - postponed declaration when possible - avoid to copy internal map inside graph - avoided o user operator[] on internal graph map in order to avoid not intended inserts - in hamiltonianCycle the "returnValue" should be returned instead of always true - removed not used variables
The Graph misses the DTOR and it leaks. If you want I can code inspect the rest.
ReplyDeletefixed and updated. Yes, please
ReplyDeleteQuick inspection, no idea if this is what you want, if this is the right direction there is still
ReplyDeletesomething to do
- between two vertex can exist more than 1 edge ? If not then the code must be improved
- Graph can inherit from a map and avoid to export via getNodes() the internal structure
- Constness
- replaced post increments with pre increment where possible
- postponed declaration when possible
- avoid to copy internal map inside graph
- avoided o user operator[] on internal graph map in order to avoid not intended inserts
- in hamiltonianCycle the "returnValue" should be returned instead of always true
- removed not used variables
You can find new version here
https://www.dropbox.com/s/clv30zbuyhlkxhb/Graph.zip
Are you going to post the chapter describing these algorithms?
ReplyDelete