Re: BOOST Graph Library (BGL)

  • From: Paulo Panhoto < >
  • To:
  • Subject: Re: BOOST Graph Library (BGL)
  • Date: Mon, 26 Nov 2012 08:10:32 -0200

Try this:

Right click the project and hover the mouse pointer over "Code assistance".

If the menu "Failed #include/#error Directives" is  grayed, try to click on "Reparse Project" (usually works). Otherwise, it means you'll have to add the boost include directories to the code assistance dialog (tools->options; C/C++ -> Code Assistance).

Hope this helps.

Regards,

Paulo.


On Sat, Nov 24, 2012 at 11:21 PM, lopatnov < " target="_blank"> > wrote:
Dear NetBeans developers,
I have a little problem with recognition of my code:
[Image: http://lopatnov.cv.ua/bgl.PNG ]

Code:

/*
 * File:   main.cpp
 * Author: Admin
 *
 * Created on 24 Ноябрь 2012 г., 16:06
 */

#include <iostream>
#include <boost/graph/adjacency_list.hpp>

// Create a struct to hold properties for each vertex

struct VertexProperties {
    int VertexIntProperty;
    std::string VertexStringProperty;
};

// Create a struct to hold properties for each edge

struct EdgeProperties {
    int EdgeIntProperty;
    std::string EdgeStringProperty;
};

// Define the type of the graph
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexProperties, EdgeProperties> Graph;

int main(int, char*[]) {
    // Create a graph object
    Graph g;

    // Add two vertices
    Graph::vertex_descriptor v0 = boost::add_vertex(g);
    Graph::vertex_descriptor v1 = boost::add_vertex(g);

    // Add an edge
    std::pair < Graph::edge_descriptor, bool> e01 = boost::add_edge(v0, v1, g);

    // Set and output the properties of a single vertex
    g[v0].VertexIntProperty = 0;
    g[v0].VertexStringProperty = "vertex 0";
    g[v1].VertexIntProperty = 1;
    g[v1].VertexStringProperty = "vertex 1";
    std::cout << g[v0].VertexIntProperty << " : " << g[v0].VertexStringProperty << std::endl;

    // Set and output the properties of a single edge
    g[e01.first].EdgeIntProperty = 5;
    g[e01.first].EdgeStringProperty = "mystring";
    std::cout << g[e01.first].EdgeIntProperty << " : " << g[e01.first].EdgeStringProperty << std::endl;

    // Set and output the properties of each vertex
    std::pair<Graph::vertex_iterator, Graph::vertex_iterator> vertexIteratorRange = boost::vertices(g);
    int i=1;
    for (Graph::vertex_iterator vertexIterator = vertexIteratorRange.first; vertexIterator != vertexIteratorRange.second; ++vertexIterator) {
        g[*vertexIterator].VertexIntProperty = i;
        //g[*vertexIterator].VertexStringProperty = "vertex";
        std::cout << g[*vertexIterator].VertexIntProperty << " : " << g[*vertexIterator].VertexStringProperty << std::endl;
        i++;
    }

    // Set and output the properties of each edge
    std::pair<Graph::edge_iterator, Graph::edge_iterator> edgeIteratorRange = boost::edges(g);
    for (Graph::edge_iterator edgeIterator = edgeIteratorRange.first; edgeIterator != edgeIteratorRange.second; ++edgeIterator) {
        i++;
        g[*edgeIterator].EdgeIntProperty = i;
        g[*edgeIterator].EdgeStringProperty = "edge";
        std::cout << g[*edgeIterator].EdgeIntProperty << " : " << g[*edgeIterator].EdgeStringProperty << std::endl;
    }

    return 0;
}



This code was compiled very well and run, but Netbeans emphasizes red lines syntax.







BOOST Graph Library (BGL)

lopatnov 11/25/2012

Re: BOOST Graph Library (BGL)

Paulo Panhoto 11/26/2012

BOOST Graph Library (BGL)

lopatnov 11/26/2012

Project Features

About this Project

CND was started in November 2009, is owned by Leonid Lenyashin, and has 130 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close