Adjacency matrix problem
Hi I m trying to implement adjacency matrix. typedef boost::adjacency_matrixboost::undirectedS Graph; Graph(N); Now here can the N be a variable as what i want is create graph by varying the value of N which taken as an input from user. Following is the snippet of my code... int main(int argc, char *argv[]) { int SIZE; cout<<"\n Enter the matrix size (nxn) :-"; cin>>SIZE; Graph g(SIZE); .................... ..................... return 0; } And the runtime error is as follows :- Assertion failed: false, file BoostLib/boost_1_34_1/boost/graph/adjacency_matrix.hpp, line 941 Same code works fine in case of adjacency_list but in case of adjacency_matrix it is giving run time error. What could be the reason for this... Thanks Abhishek Vyas Tata Consultancy Services Mailto: abhishek.v@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Hi, it looks like adjacency_matrix does not allow for adding of vertices at the moment. Maybe this should be stated somewhere in the docs (it is there implicitly, as there is no add_vertex function listed ... ). You don't need to add vertices if you supply the num-vertex parameter, they are already contained in your graph. hth Moritz -- Moritz Hilger Combinatorial Optimization & Graph Algorithms TU Berlin +49 30 314-25773
participants (2)
-
abhishek.v@tcs.com
-
moritz Hilger