Thread: Graph planarization by boost library

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    Graph planarization by boost library

    Hello, dear programmers community.

    I very need your help, in advance sorry for my bad english.

    I try to get planar coords from my graph from function
    chrobak_payne_straight_line_drawing
    but it calls System.AccessViolationException at the 125 line of file chrobak_payne_drawing.hpp:
    Code:
     delta_x[v3] = 1;
    I give below my code:
    Code:
    //Initialize the interior edge index                  property_map<graph, edge_index_t>::type e_index = get(edge_index, bmTG);
                      graph_traits<graph>::edges_size_type edge_count = 0;
                      graph_traits<graph>::edge_iterator ei, ei_end;
                      for(tie(ei, ei_end) = edges(bmTG); ei != ei_end; ++ei)
                        put(e_index, *ei, edge_count++);
    
    
                     typedef std::vector< graph_traits<graph>::edge_descriptor > vec_t;
                     std::vector<vec_t> embedding2(num_vertices(bmTG));
    
                      embedding_storage_t embedding_storage(num_vertices(bmTG));
                     embedding_t embedding(embedding_storage.begin(), get(vertex_index,bmTG));
                      if(boyer_myrvold_planarity_test(boyer_myrvold_params::graph = bmTG,boyer_myrvold_params::embedding = &embedding2[0])) {
                         label1->Text = "Planar";
                         
                         // Find a canonical ordering
                          typedef std::vector<graph_traits<graph>::vertex_descriptor> 
        ordering_storage_t;
      
                            ordering_storage_t ordering;
                          make_biconnected_planar(bmTG, &embedding2[0]);
                          make_maximal_planar(bmTG, &embedding2[0]);
                          planar_canonical_ordering(bmTG, &embedding2[0], std::back_inserter(ordering));
    
    
                          //Set up a property map to hold the mapping from vertices to coord_t's
                          typedef std::vector< coord_t > straight_line_drawing_storage_t;
                          typedef boost::iterator_property_map
                            < straight_line_drawing_storage_t::iterator, 
                              property_map<graph, vertex_index_t>::type 
                            >
                            straight_line_drawing_t;
    
    
                          straight_line_drawing_storage_t straight_line_drawing_storage
                            (num_vertices(bmTG));
                          straight_line_drawing_t straight_line_drawing
                            (straight_line_drawing_storage.begin(), 
                             get(vertex_index,bmTG)
                             );
    
    
    
    
                          
    
    
                          chrobak_payne_straight_line_drawing(bmTG, 
                                                              embedding2, 
                                                              ordering.begin(),
                                                              ordering.end(),
                                                              straight_line_drawing
                                                              );
                          graph_traits<graph>::vertex_iterator vi, vi_end;
                          for(tie(vi,vi_end) = vertices(bmTG); vi != vi_end; ++vi)
                            {
                              coord_t coord(get(straight_line_drawing,*vi));
                              this->gI->planarCoord(coord.x, coord.y, *vi);
                            }
                            this->gI->setState(PLPAINT);
                            this->gI->paintGraph();
                     }
                     else {
                         label1->Text = "Not planar";
                     }
    Where bmTG - my Graph.

    before using this code, I surely fill the graph..

    Please help me with my problem, I am desperate and can not understand the reason for the critical error .. If you do not have too much trouble, give an example of code that will be 100% faithful gave the coordinates for the vertices of the graph, if it is planar, otherwise did not do anything that is not cause critical errors in any case.

    I almost forgot, I'm using visual studio 2010

    In advance, very big thanks!
    Last edited by marsh123; 11-27-2011 at 03:19 PM.

  2. #2
    Registered User
    Join Date
    Nov 2011
    Posts
    2
    And examples.

    On this graph i have critical error:
    Graph planarization by boost library-1grb-jpg

    but this graph sucessfuly planiarized:
    Graph planarization by boost library-2gr-jpg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. some help on downloading boost library
    By Masterx in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-01-2009, 10:13 AM
  2. erasing elements from a boost::ptr_vector (boost n00b)
    By Marcos in forum C++ Programming
    Replies: 2
    Last Post: 04-04-2006, 12:54 PM
  3. Replies: 19
    Last Post: 01-12-2006, 11:04 AM
  4. Boost Graph Library
    By CornedBee in forum C++ Programming
    Replies: 2
    Last Post: 09-23-2005, 03:00 PM
  5. link error: with Boost date_time library
    By Hotman_x in forum C++ Programming
    Replies: 0
    Last Post: 01-14-2003, 07:54 AM

Tags for this Thread