473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Boost read_graphml example

I'm trying to build a simple GraphML loader using BOOST libraries. I have a GraphML file and I want to load it in a boost adjacency list structure. The graph is directed and the only information that it is stored are the name of the nodes (0,1,2,...) and the edges from one node to another. What I did is:

Expand|Select|Wrap|Line Numbers
  1. void loadHierarchy(){
  2.     // ...
  3.     std::ifstream inFile;
  4.     inFile.open("ext.gml", std::ifstream::in);
  5.  
  6.     typedef boost::adjacency_list<> Graph;
  7.     Graph g;
  8.  
  9.     boost::read_graphml(inFile, g);
  10.     // ...
  11. }
I don't need to use any properties, just to keep the whole graph information in the adjacency list.

The errors that I get are the following:

Expand|Select|Wrap|Line Numbers
  1. error: invalid initialization of reference of type ‘boost::mutate_graph&’ from expression of type ‘loadHierarchy()::Graph’
  2.  
  3. /usr/include/boost/graph/graphml.hpp:194: error: in passing argument 2 of ‘void boost::read_graphml(std::istream&, boost::mutate_graph&)’
  4.  
It should be as simple as that, but apparently it isn't.

Any answer would be really appreciated.

Thanks in advance.
Jul 29 '11 #1

✓ answered by weaknessforcats

You will need to look in the boost header and confirm that adjacentcy_list has a base class, direct or indirect, of mutate_graph.

You might also write a class Graph that derives from mutate_graph and then remove that typedef and see if things compile at least past the line where the error presently occurs.

3 4092
weaknessforcats
9,208 Expert Mod 8TB
Argument 2 must be a mutate_graph& and you are not passing that type.
Jul 30 '11 #2
That is correct.
However, to the best of my knowledge, boost::adjacency_list is a mutate graph. I've tried also different initialization of adjacency list using vecS, etc... still cannot get something that compiles.
Jul 30 '11 #3
weaknessforcats
9,208 Expert Mod 8TB
You will need to look in the boost header and confirm that adjacentcy_list has a base class, direct or indirect, of mutate_graph.

You might also write a class Graph that derives from mutate_graph and then remove that typedef and see if things compile at least past the line where the error presently occurs.
Jul 30 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: eyal.susser | last post by:
Hi, I'm using the Boost serialization library. Iwant to serialize classes into simple buffers on RAM. There doesn't seem to be a suitable archiver. Am I missing it? The ones I saw were for...
7
by: derek.google | last post by:
I hope a Boost question is not too off-topic here. It seems that upgrading to Boost 1.33 broke some old regex code that used to work. I have reduced the problem to this simple example: cout <<...
5
by: ogerchikov | last post by:
Hi, I am reading a Boost.lambda example http://www.awprofessional.com/articles/article.asp?p=400651&seqNum=4. Here is the example: void demoVector() { vector<int> myvector;...
4
by: Gary Wessle | last post by:
Hi given the Boost thread example here http://www-eleves-isia.cma.fr/documentation/BoostDoc/boost_1_29_0/libs/thread/example/thread.cpp the code below attempts to run the example thread while...
2
by: soren.andersen | last post by:
Hello out there :-) I'm new to c++, coming from Java, and trying to learn the basics of the language and all that, basically just for fun. :-) So, when once I played around with c++ a bit i...
0
by: Osiris | last post by:
My experiences with BOOST on Windows XP and Visual C++ 2005 I'm new to Python. I built software in more than ten other computer languages. I'm not sure if that is not a handicap, when reading...
6
by: Soren | last post by:
Hi! I'm trying to extend my python program with some C++ code. Right now I've spent hours just trying to get boost to work! I'm trying to get the example hello.cpp to work. Using Windows XP...
2
by: mr_gees100_peas | last post by:
Hi, I've been trying for days to make either boost.python or swig to work for me. The one I have gotten the closest to is boost. Note that this is for windows XP. I'm not much of an unix person...
1
by: saby | last post by:
Can anybody give me any example code of Boost using __VA_ARG__ facility? Thanks in advance.
3
by: Travis | last post by:
I'm trying to figure out how to use Boost? For example, I'd like to use the is_equal function to test two strings but I can't figure out exactly what to include or how to call the method. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.