Utilities

This is just a collection of helpful utilities.

class jgrapht.utils.IntegerSupplier(start=0)[source]

An integer supplier which returns integers starting from zero.

class jgrapht.utils.StringSupplier(prefix=None, start=0)[source]

A string supplier which returns integers starting from zero with a possible custom prefix.

jgrapht.utils.create_edge_supplier(type='str', prefix='e', start=0)[source]

Create an edge supplier. Εdge suppliers are called whenever an any-hashable graph wants to create a new edge.

Parameters
  • type – type can be either ‘str’ or ‘int’

  • prefix – if a string supplier, a prefix to use

  • start – where to start counting

Returns

an edge supplier

jgrapht.utils.create_vertex_supplier(type='str', prefix='v', start=0)[source]

Create a vertex supplier. Vertex suppliers are called whenever an any-hashable graph wants to create a new vertex.

Parameters
  • type – type can be either ‘str’ or ‘int’

  • prefix – if a string supplier, a prefix to use

  • start – where to start counting

Returns

a vertex supplier