deciding directed and undirected parameter of adjancency list at runtime .
Hi I have a function which take an input from the user whether the graph is directed or undirected. I'm declaring graph as follows :- typedef adjacency_list < vecS, vecS, undirectedS, property < vertex_name_t,std::string >, property < edge_name_t, std::string > > Graph; Graph g; Now here the parameter in Bold need to be varied as the user input changes. One method could be i could have two different function say,CreateDirected() and CreateUndirected(). But this is not working in my case as i want the declaration should be global so that i can use it throughout my application. Please help. 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
I have a function which take an input from the user whether the graph is directed or undirected. I'm declaring graph as follows :-
typedef adjacency_list < vecS, vecS,* undirectedS*, property < vertex_name_t,std::string >, property < edge_name_t, std::string > > Graph; Graph g;
Now here the parameter in Bold need to be varied as the user input changes. One method could be i could have two different function say,CreateDirected() and CreateUndirected(). But this is not working in my case as i want the declaration should be global so that i can use it throughout my application. Please help. That's actually a bit tricky in the BGL, as you've noted. My suggestion would be to use bidirectionalS as the directedness tag, which gives you a directed graph with access to both the incoming and the outgoing edges. Then, it is relatively easy to write a graph adaptor that views an existing bidirectional graph as an undirected graph. I that someone
abhishek.v@tcs.com wrote: posted on to the Boost mailing list recently, but I can't find it now :( - Doug
Hi,,, In my case i have a input file which holds the graph information . In the format A,B,C,D,E A,0,1,0,1,0 B,0,0,0,0,1 C,0,1,0,0,1 D,1,0,0,0,1 E,0,0,0,0,0 Now i m able to extract information from the file and create graph using adjancency list now what i require is that if the matrix of (0 &1) is symmetric graph of type undirected should be created and if it is unsymmetric it should be BidirectionalS . Will the solution provided by you to create adaptor help in this senario what could be the best way to approach this problem.. Abhishek Vyas Tata Consultancy Services Mailto: abhishek.v@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ boost-users-bounces@lists.boost.org wrote on 09/11/2007 07:09:20 PM:
abhishek.v@tcs.com wrote:
I have a function which take an input from the user whether the graph
is directed or undirected. I'm declaring graph as follows :-
typedef adjacency_list < vecS, vecS,* undirectedS*, property < vertex_name_t,std::string >, property < edge_name_t, std::string > > Graph; Graph g;
Now here the parameter in Bold need to be varied as the user input changes. One method could be i could have two different function say,CreateDirected() and CreateUndirected(). But this is not working in my case as i want the declaration should be global so that i can use it throughout my application. Please help. That's actually a bit tricky in the BGL, as you've noted. My suggestion would be to use bidirectionalS as the directedness tag, which gives you a directed graph with access to both the incoming and the outgoing edges. Then, it is relatively easy to write a graph adaptor that views an existing bidirectional graph as an undirected graph. I that someone posted on to the Boost mailing list recently, but I can't find it now :(
- Doug _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
ForwardSourceID:NT00048A0A =====-----=====-----===== 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
participants (2)
-
abhishek.v@tcs.com
-
Douglas Gregor