Boost logo

Boost Users :

Subject: Re: [Boost-users] Implementing matrix_as_graph to convert a boost::numeric::ublas::matrix to a "graph"
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-28 23:43:25


John Burgoon wrote:
> 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.

I don't know what matrix_as_graph is designed for, but it can't
handle uBlas matrices.

In Christ,
Steven Watanabe

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at