7. Dealing with Vertices

There are several operations that can be performed directly on the vertices of a graph.

class pypgx.api.VertexLabels(graph, java_labels)
class pypgx.api.VertexProperty(graph, java_prop)
get(key)
Parameters

key – The key (vertex/edge) whose property to get

set(key, value)

Set a property value.

Parameters
  • key – The key (vertex/edge) whose property to set

  • value – The property value

set_values(values)

Set the labels values. :param values: pgxmap with ids and values

class pypgx.api.VertexSequence(graph, java_collection)

An ordered sequence of vertices which may contain duplicates.

class pypgx.api.VertexSet(graph, java_collection)

An unordered set of vertices (no duplicates).

extract_top_k_from_map(pgx_map, k)

Extract the top k keys from the given map and puts them into this collection.

Parameters
  • pgx_map – the map to extract the keys from

  • k – how many keys to extract