8. Dealing with Edges

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

class pypgx.api.EdgeCollection(graph, java_collection)

A collection of edges.

add(e)

Add one or multiple edges to the collection.

Parameters

e – Edge or edge id. Can also be an iterable of edge/edge ids.

add_all(edges)

Add multiple vertices to the collection.

Parameters

edges – Iterable of edges/edges ids

contains(e)

Check if the collection contains edge e.

Parameters

e – PgxEdge object or id:

Returns

Boolean

remove(e)

Remove one or multiple edges from the collection.

Parameters

e – Edges or edges id. Can also be an iterable of edges/edges ids.

remove_all(edges)

Remove multiple edges from the collection.

Parameters

edges – Iterable of edges/edges ids

class pypgx.api.EdgeSequence(graph, java_collection)

An ordered sequence of edges which may contain duplicates.

class pypgx.api.EdgeSet(graph, java_collection)

An unordered set of edges (no duplicates).