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 <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to