Boost&x27;s图形库链接顶点和输出边列表容器?

Boost&x27;s图形库链接顶点和输出边列表容器?,boost,graph,containers,Boost,Graph,Containers,根据,顶点及其对应的输出边有两种主要的容器类型,默认情况下这两种类型都是向量 这两者之间是否存在任何联系,就像地图一样,关键点是顶点,值是输出边的向量?或者你知道每个顶点指向什么吗?因为顶点作为一个唯一的整数存储在顶点列表中,每个顶点就像是某种向量向量的索引,每个向量都包含该顶点的输出边 基本上,一个顶点是如何链接到Boost邻接列表中对应的传出边列表的?邻接列表中的每个顶点项(称为存储的顶点)都有一个外边容器,如果是双向的,则有内边容器。下面是如何定义存储顶点的各种风格: // sto

根据,顶点及其对应的输出边有两种主要的容器类型,默认情况下这两种类型都是向量

这两者之间是否存在任何联系,就像地图一样,关键点是顶点,值是输出边的向量?或者你知道每个顶点指向什么吗?因为顶点作为一个唯一的整数存储在顶点列表中,每个顶点就像是某种向量向量的索引,每个向量都包含该顶点的输出边


基本上,一个顶点是如何链接到Boost邻接列表中对应的传出边列表的?

邻接列表中的每个顶点项(称为
存储的顶点)都有一个外边容器,如果是双向的,则有内边容器。下面是如何定义存储顶点的各种风格:

    // stored_vertex and StoredVertexList
    typedef typename container_gen<VertexListS, vertex_ptr>::type
      SeqStoredVertexList;
    struct seq_stored_vertex {
      seq_stored_vertex() { }
      seq_stored_vertex(const VertexProperty& p) : m_property(p) { }
      OutEdgeList m_out_edges;
      VertexProperty m_property;
      typename SeqStoredVertexList::iterator m_position;
    };
    struct bidir_seq_stored_vertex {
      bidir_seq_stored_vertex() { }
      bidir_seq_stored_vertex(const VertexProperty& p) : m_property(p) { }
      OutEdgeList m_out_edges;
      InEdgeList m_in_edges;
      VertexProperty m_property;
      typename SeqStoredVertexList::iterator m_position;
    };
    struct rand_stored_vertex {
      rand_stored_vertex() { }
      rand_stored_vertex(const VertexProperty& p) : m_property(p) { }
      OutEdgeList m_out_edges;
      VertexProperty m_property;
    };
    struct bidir_rand_stored_vertex {
      bidir_rand_stored_vertex() { }
      bidir_rand_stored_vertex(const VertexProperty& p) : m_property(p) { }
      OutEdgeList m_out_edges;
      InEdgeList m_in_edges;
      VertexProperty m_property;
    };

    //! This generates the actual stored_vertex type based on 
    //! the container type.
    typedef typename mpl::if_<is_rand_access,
      typename mpl::if_<BidirectionalT,
        bidir_rand_stored_vertex, rand_stored_vertex>::type,
      typename mpl::if_<BidirectionalT,
        bidir_seq_stored_vertex, seq_stored_vertex>::type
    >::type StoredVertex;
    struct stored_vertex : public StoredVertex {
      stored_vertex() { }
      stored_vertex(const VertexProperty& p) : StoredVertex(p) { }
    };
//存储的顶点和存储的顶点列表
typedef typename容器\u gen::type
SeqStoredVertexList;
结构顺序存储顶点{
seq_存储的_顶点(){}
seq_存储的_顶点(const VertexProperty&p):m_属性(p){}
OutEdgeList m_out_边;
VertexProperty m_属性;
typename SeqStoredVertexList::迭代器m_位置;
};
结构bidir_seq_存储的_顶点{
bidir_seq_存储的_顶点(){}
bidir_seq_存储的_顶点(const VertexProperty&p):m_属性(p){}
OutEdgeList m_out_边;
无边列表m_in_边;
VertexProperty m_属性;
typename SeqStoredVertexList::迭代器m_位置;
};
结构随机存储顶点{
随机存储的顶点(){}
随机存储的顶点(const VertexProperty&p):m_属性(p){}
OutEdgeList m_out_边;
VertexProperty m_属性;
};
结构bidir\u rand\u存储的\u顶点{
bidir_rand_存储的_vertex(){}
bidir_rand_存储的_顶点(const VertexProperty&p):m_属性(p){}
OutEdgeList m_out_边;
无边列表m_in_边;
VertexProperty m_属性;
};
//! 这将根据生成实际存储的顶点类型
//! 容器类型。
typedef typename mpl::if::type StoredVertex;
结构存储顶点:公共存储顶点{
存储的_顶点(){}
存储顶点(const VertexProperty&p):存储顶点(p){
};
如果顶点的列表类型为随机访问,则顶点描述符类型为std::size\t,表示存储顶点
实例向量中顶点的索引。如果列表类型是基于节点的序列(如列表),则顶点描述符是存储的顶点的内存地址(强制转换为void*)。这两种情况都提供了从顶点描述符到底层存储顶点的映射,从而映射到相关的边列表