Ah, I missed that add_edge_list() returns a property map in that case. So the property map should have my application's vertex IDs in it as long as I use hashed=True. I'll give that a try. Thanks.

On Wed, Jan 17, 2018 at 12:32 AM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 17.01.2018 06:34, Spencer Gardner wrote:
> I'm converting a pandas dataframe to a gt graph. I can successfully add
> edges with accompany attributes from the dataframe, but the network I'm
> building has its own internal vertex and edge IDs that I need to be able to
> reference. I can store the edge IDs when adding edges with the eprops=
> argument. However, it's unclear how I can associate my vertex IDs to the
> vertices. Is there an established way to do this?

I assume you mean using the Graph.add_edge_list() function. In which case,
take a look at the behavior of the 'hashed' parameter. From the documentation:

    Optionally, if ``hashed == True``, the vertex values in the edge list
    are not assumed to correspond to vertex indices directly. In this case
    they will be mapped to vertex indices according to the order in which
    they are encountered, and a vertex property map with the vertex values
    is returned. If ``string_vals == True``, the algorithm assumes that the
    vertex values are strings. Otherwise, they will be assumed to be numeric
    if ``edge_list`` is a :class:`~numpy.ndarray`, or arbitrary python
    objects if it is not.

Tiago de Paula Peixoto <tiago@skewed.de>

graph-tool mailing list