## PropertyGraph

A PropertyGraph is a graph that has some property associated with each of the vertices or edges in the graph. As a given graph may have several properties associated with each vertex or edge, a tag is used to identity which property is being accessed. The graph provides a function which returns a property map object.

### Refinement of

Graph

### Notation

`G` | A type that is a model of PropertyGraph.
`g` | An object of type `G`.
`X` | Either the vertex or edge descriptor type for `G`.
`x` | An object of type `X`.
`Map` | The type `boost::property_map<G, Property>::const_type`.
`v` | An object of type `boost::property_traits<Map>::value_type`.
`Property` | A type that models the Property concept.
`p` | An object of type `Property`.
`pmap` | An object of type `Map`.

### Associated types

    boost::property_map<G, Property>::type

The type of the property map for the property specified by `Property`. This type must be a model of ReadWritePropertyMap with a key type the same as the graph's vertex or descriptor type.

    boost::property_map<G, Property>::const_type

The type of the const property map for the property specified by `Property`. This type must be a model of ReadablePropertyMap with a key type the same as the graph's vertex or edge descriptor type.

### Valid Expressions

`get(p, g)` | Returns the property map for the property specified by the `Property` type. The object `p` is only used to carry the type. Return type: `boost::property_map<G, Property>::type` if `g` is mutable and `boost::property_map<G, Property>::const_type` otherwise.
`get(p, g, x)` | Returns the property value (specified by the `Property` type) associated with object `x` (a vertex or edge). The object `p` is only used to carry the type. This function is equivalent to: `get(get(p, g), x)` Return type: `boost::property_traits<Map>::value_type`
`put(p, g, x, v)` | Set the property (specified by the `Property` type) associated with object `x` (a vertex or edge) to the value `v`. The object `p` is only used to carry the type. This function is equivalent to: `pmap = get(p, g); put(pmap, x, v)` Return type: `void`

### Complexity

The `get()` property map function must be constant time.

### Models

- `adjacency_list` with `VertexProperty=property<vertex_distance_t,int,property<vertex_in_degree_t,int> >` and `Property=vertex_distance_t`.
- `adjacency_list` with `VertexProperty=property<vertex_distance_t,int,property<vertex_in_degree_t,int> >` and `Property=vertex_in_degree_t`.

### Concept Checking Class

      template <class Graph, class X, class Property>
      struct PropertyGraphConcept
      {
        typedef typename property_map<G, Property>::type Map;
        typedef typename property_map<G, Property>::const_type const_Map;
        void constraints() {
          function_requires< GraphConcept<G> >();
          function_requires< ReadWritePropertyMapConcept<Map, X> >();
          function_requires< ReadablePropertyMapConcept<const_Map, X> >();

          Map pmap = get(Property(), g);
          pval = get(Property(), g, x);
          put(Property(), g, x, pval);
          ignore_unused_variable_warning(pmap);
        }
        void const_constraints(const G& g) {
          const_Map pmap = get(Property(), g);
          pval = get(Property(), g, x);
          ignore_unused_variable_warning(pmap);
        }
        G g;
        X x;
        typename property_traits<Map>::value_type pval;
      };

### See Also

`property_map`

Copyright © 2000 | Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu)