Boost Users :
Subject: [Boost-users] Implementing matrix_as_graph to convert a boost::numeric::ublas::matrix to a "graph"
From: John Burgoon (noogrub_at_[hidden])
Date: 2009-03-28 21:34:38
I wrote a small program in C++ using boost to read a neural network file
(directional graph of a feedforward multilayer perceptron) into
boost::numeric::ublas::matrix. The typical file size creates matrices of
various sizes, anywhere from a 36x36 to a 130x130 matrix (of floats - edge
weights between 0 and 1 to four sig figs). About half to two-thirds of the
values are 0 in a typical graph, so I think of them as sparse. There are
thousands of such files, so I have been really thrilled with the speed of
boost. (I was doing this work with Perl last year. Ahem.)
Now I want to implement the boost matrix_as_graph library so that I can
convert my matrix into a graph and then implement various network metrics on
the graph (such as betweenness_centrality.hpp). However, when I looked in
the docs at
I was dismayed to find only a code listing: no explanation, no examples.
I'm not the strongest C++ coder. Can someone point me to an example or
tutorial of how to implement matrix_as_graph to turn a ublas::matrix into a
graph? I think I could puzzle it out if I could find an example to emulate.
I'll repay the community with a simple blog tutorial of how I did it, if
someone can only help me get started.
Thanks in advance,
-- John Burgoon Indiana University Bloomington, IN, USA -- >>Insight without implementation is worthless. Get to work.
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