Boost logo

Boost Users :

Subject: Re: [Boost-users] Graphviz and Boost Problem
From: ef (snorlaxgb_at_[hidden])
Date: 2010-09-07 20:44:41


Hello,
Ive been implementing my own solution to this problem, and Ive ran into a
deadwall if anyone can give me some advice on, as I am at a dead end in
fixing this.

Under do_edge () function (boost/libs/graph/src/read_new_graphviz.hpp
I replaced:
  r.edges.push_back(e);
With:
typedef boost::detail::graph::edge_t edge;
 edge e1 = edge::new_edge();
 mg->do_add_edge(e1,e.source.name,e.target.name);

I received a *segfault* on the following dot file:
digraph outputGraph{
"0-3|standard"->"0-7|standard"
}

under node_and_port parse_node_and_port(const token&
name,::boost::detail::graph::mutate_graph* mg)
 I removed the stuff at the bottom that pushes it into an stl datastruct
with:
 if (!mg->vertex_exists(id.name)){
                 mg->do_add_vertex(id.name);
            }

Here is the back trace, anyone have any ideas??(Maybe I should of made this
shorter but I dont know any better):

#0 0x00007ffff755ef70 in std::_List_node_base::hook(std::_List_node_base*)
() from /usr/lib/libstdc++.so.6
#1 0x000000000041b254 in std::list<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> >,
std::allocator<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> > >
>::_M_insert (this=0x0, __position=..., __x=...) at
/usr/include/c++/4.4/bits/stl_list.h:1408
#2 0x000000000041a626 in std::list<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> >,
std::allocator<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> > >
>::push_back (this=0x0, __x=...) at /usr/include/c++/4.4/bits/stl_list.h:920
#3 0x0000000000419228 in
boost::graph_detail::push_dispatch<std::list<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> >,
std::allocator<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> > > >,
boost::detail::sep_<void*, boost::property<boost::edge_weight_t, int,
boost::no_property> > > (c=..., v=...) at
boost_1_43_0/boost/pending/container_traits.hpp:426
#4 0x000000000041617a in
boost::graph_detail::push<std::list<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> >,
std::allocator<boost::detail::sep_<void*,
boost::property<boost::edge_weight_t, int, boost::no_property> > > >,
boost::detail::sep_<void*, boost::property<boost::edge_weight_t, int,
boost::no_property> > > (c=..., v=...) at
boost_1_43_0/boost/pending/container_traits.hpp:458
#5 0x00000000004124d8 in
boost::add_edge<boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS>, boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS>::config> (
    u=0x0, v=0x0, p=..., g_=...) at
boost_1_43_0/boost/graph/detail/adjacency_list.hpp:679
#6 0x0000000000410083 in
boost::add_edge<boost::detail::adj_list_gen<boost::adjacency_list<boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS>, boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS>::config> (
    u=0x0, v=0x0, g_=...) at
boost_1_43_0/boost/graph/detail/adjacency_list.hpp:693
#7 0x000000000040e9ef in
boost::detail::graph::mutate_graph_impl<boost::adjacency_list<boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS> >::do_add_edge
(this=0x7fffffffe550, edge=...,
    source=..., target=...) at boost_1_43_0/boost/graph/graphviz.hpp:811
#8 0x00007ffff7b7383f in boost::read_graphviz_detail::parser::do_edge
(this=0x7fffffffe330, src=..., tgt=..., props=..., mg=0x7fffffffe550)
    at ../../../libs/graph/src/read_graphviz_new.cpp:747
#9 0x00007ffff7b72d93 in boost::read_graphviz_detail::parser::do_orig_edge
(this=0x7fffffffe330, src=..., tgt=..., props=..., mg=0x7fffffffe550)
    at ../../../libs/graph/src/read_graphviz_new.cpp:682
#10 0x00007ffff7b72c05 in
boost::read_graphviz_detail::parser::parse_edge_stmt (this=0x7fffffffe330,
lhs=..., mg=0x7fffffffe550)
    at ../../../libs/graph/src/read_graphviz_new.cpp:672
#11 0x00007ffff7b70f11 in boost::read_graphviz_detail::parser::parse_stmt
(this=0x7fffffffe330, mg=0x7fffffffe550) at
../../../libs/graph/src/read_graphviz_new.cpp:472
#12 0x00007ffff7b70ae7 in
boost::read_graphviz_detail::parser::parse_stmt_list (this=0x7fffffffe330,
mg=0x7fffffffe550) at ../../../libs/graph/src/read_graphviz_new.cpp:450
#13 0x00007ffff7b7089f in boost::read_graphviz_detail::parser::parse_graph
(this=0x7fffffffe330, want_directed=true, mg=0x7fffffffe550)
    at ../../../libs/graph/src/read_graphviz_new.cpp:442
#14 0x00007ffff7b6bdfd in
boost::read_graphviz_detail::parse_graphviz_from_string (str=...,
result=..., want_directed=true, mg=0x7fffffffe550)
    at ../../../libs/graph/src/read_graphviz_new.cpp:780
#15 0x00007ffff7b6c2fd in boost::detail::graph::read_graphviz_new (str=...,
mg=0x7fffffffe550) at ../../../libs/graph/src/read_graphviz_new.cpp:869
#16 0x000000000040bb85 in
boost::read_graphviz_new<boost::adjacency_list<boost::listS, boost::listS,
boost::directedS, boost::property<boost::vertex_name_t, std::string,
boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS> > (str=...,
graph=..., dp=..., node_id=...)
    at boost_1_43_0/boost/graph/detail/read_graphviz_new.hpp:103
#17 0x000000000040b1a9 in boost::read_graphviz<std::istream_iterator<char,
char, std::char_traits<char>, long>, boost::adjacency_list<boost::listS,
boost::listS, boost::directedS, boost::property<boost::vertex_name_t,
std::string, boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS> > (
    user_first=..., user_last=..., graph=..., dp=..., node_id=...) at
boost_1_43_0/boost/graph/graphviz.hpp:930
#18 0x000000000040a97e in
boost::read_graphviz<boost::adjacency_list<boost::listS, boost::listS,
boost::directedS, boost::property<boost::vertex_name_t, std::string,
boost::no_property>, boost::property<boost::edge_weight_t, int,
boost::no_property>, boost::no_property, boost::listS> > (in=..., graph=...,
dp=..., node_id=...)
    at boost_1_43_0/boost/graph/graphviz.hpp:942
#19 0x00000000004086d9 in test_graph_read_write (filename=...) at
graphviz.cpp:41
#20 0x0000000000408844 in main () at graphviz.cpp:52

Thanks,
EF

On Sat, Sep 4, 2010 at 1:54 PM, ef <snorlaxgb_at_[hidden]> wrote:

> Hello,
> Thankfully it does not need to be in dot language. I have invested
> minimally in it. I am also realizing that this parser is very complex. I
> dont need any of the complexity graphviz offers. I think you are right
> though I need to use my own parser or maybe looking into another format.
>
> Thank You for your priceless advice!
> EF
>
>
> On Sat, Sep 4, 2010 at 1:36 PM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:
>
>> On Sat, 4 Sep 2010, ef wrote:
>>
>> Yeah sadly it is a very huge graph (atleast 300 million nodes). I have
>>> also written aglorithms that do the analysis while they are created,
>>> otherwise it would just be to complex. I will go ahead and look into your
>>> suggestions.
>>>
>>
>> Does that large of a graph need to be in Graphviz format? The parser is
>> complicated because the language itself is complicated (such as attributes
>> for subgraphs). If you are writing the graph yourself, you might want to
>> use a simpler format (like DIMACS); even if someone else is producing it in
>> Graphviz format, you may want to consider writing a custom parser that only
>> handles the subset of the language that your file uses and creates your
>> graph type directly.
>>
>>
>> -- Jeremiah Willcock
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net