Boost logo

Boost Users :

From: Alec Resnick (aresnick_at_[hidden])
Date: 2007-01-09 15:13:27


It would seem that I'm having a bit of trouble nailing down the scope
of a typedef of the adjacency_list type in a class I'm writing. For
some reason, I keep getting the error "error: 'directed_graph' does
not name a type" when trying to compile the following code using
XCode 2.4 with the boost library installed via DarwinPorts and the
appropriate library and search paths (/opt/local/lib/ and /opt/local/
include/) set.

If someone could help me out with this, I would very much appreciate
it. Thanks for your time!

Gratefully,
a.

/*
  * GARN.h
  * GA_RuleNetwork
  *
  * Created by Alec Resnick on 1/8/07.
  * Copyright 2007 dror. All rights reserved.
  *
  */

#ifndef GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE
#define GRAPH_AUTOMATA_RULE_NETWORK_CLASS_HEADER_FILE

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <boost/graph/adjacency_list.hpp>

#include "GARN_helpers.h"
#include "GARN_neighborhood.h"

using namespace std;
using namespace boost;

class GARN{
        typedef property<edge_name_t, int> edge_property;
        typedef property<vertex_name_t, GARN_neighborhood> vertex_property;
        typedef adjacency_list<vecS, vecS, directedS, vertex_property,
edge_property> directed_graph;
        typedef graph_traits<directed_graph>::vertex_descriptor vertex;
        typedef graph_traits<directed_graph>::edge_descriptor edge;
        
private:
        vector<int> lookupTable;
        int neighborhoodSize;
        int numStates;
        int ruleNumber;
        directed_graph ruleNetwork;
        vector<GARN_neighborhood> neighborhoodSpace;
        
public:
        //
Constructors------------------------------------------------------------
->
        GARN();
        GARN(int,int,int);

        
        //
Destructors-------------------------------------------------------------
->
        ~GARN();
        
        
        //
Accessors---------------------------------------------------------------
->
        directed_graph get_ruleNetwork();
        
        
        //
Mutators----------------------------------------------------------------
->
};

//
Constructors------------------------------------------------------------
----->
GARN::GARN(){
        
}

GARN::GARN(int _ruleNumber, int _numStates, int _neighborhoodSize){
        ruleNumber = _ruleNumber;
        numStates = _numStates;
        neighborhoodSize = _neighborhoodSize;
        
        int neighborhoodSpaceSize = int(pow(numStates,neighborhoodSize));
        
        lookupTable = intToNary(ruleNumber, numStates, neighborhoodSpaceSize);
        
        typedef property_map<directed_graph, vertex_name_t>::type vertex_map;
        typedef property_map<directed_graph, edge_name_t>::type edge_map;
        
        vertex_map vertexState = get(vertex_name, ruleNetwork);
        edge_map edgeState = get(edge_name, ruleNetwork);
        
        vertex parent, child;
        
        for(int i = 0 ; i < neighborhoodSpaceSize; ++i){
                parent = add_vertex(ruleNetwork);
                child = add_vertex(ruleNetwork);
                
                GARN_neighborhood firstGeneration(intToNary
(i,numStates,neighborhoodSize));
                GARN_neighborhood secondGeneration(firstGeneration.stepTo
(lookupTable.at(i)));
                
                vertexState[parent] = firstGeneration;
                vertexState[child] = secondGeneration;
        }
}

//
Destructors-------------------------------------------------------------
----->
GARN::~GARN(){
        
}

//
Accessors---------------------------------------------------------------
----->
directed_graph GARN::get_ruleNetwork(){
        return ruleNetwork;
}

//
Mutators----------------------------------------------------------------
----->
#endif


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