Boost logo

Boost Users :

From: Aaron Windsor (aaron.windsor_at_[hidden])
Date: 2007-03-01 06:51:49


On 2/28/07, Shams <shams_at_[hidden]> wrote:
> Hi,
>
> I would like to know how to "best" represent a filesystem using BGL.
> In this case the filesystem I want to describe is the unix/linux filesystem
> and its various paths from the root node "/".

Hi Shams,

> My questions:
> 1. What kind of graph is this filesystem and what is best to use in BGL to
> describe this?

The graph defined by the hard links is a tree. The BGL graph you use would
depend on what you want to do. For instance, you might want to use a directed
graph with edges pointing from a directory to each of its contents, but I'd have
to know more about what you want to do to suggest anything.

> 2. How can I also best describe symbolic links (symlinks) and what kind of
> graph
> would this be, does this graph defer from the above?

Symbolic links can create cycles in the graph, so that the graph is no longer
a tree. You can use edge properties to specify the type of link an edge
represents here - filtering on the hard link properties gives you a tree.

> 3. How can I describe the metadata of a file (including symlinks) using BGL
> eg. given a path /usr/bin/ls I also want to stores its creation date, acl
> etc in BGL,
> how can I best describe this, is there where properties come in handy?

Yes, exactly - properties can be used to create a mapping between vertices/edges
and other types, i.e. mapping each vertex to a string or an integer.

> 4. Are there any examples on this anywhere and/or does the BGL book describe
> any examples on this?

Yes, there are many examples online, and the book has an example of building
a file dependency graph.

Regards,
Aaron


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