Regular graph

Regular graphs are translation invariant graphs in the d-dimensional integer grid. Regular graphs do not explicitly store edges: they are thus not suited to represent edge weighted graphs.

For a given dimension \(N\in\{1,2,3,4,5\}\), there is a specific regular graph class called RegularGraphNd. All the specific regular graph classes implement the same interface.

class RegularGraph2d(shape, neighbour_list)
__init__(shape, neighbour_list)

Creates a new regular grid graph

Example:

>>> # construct implicit 6 adj 3D graph
>>> adj_6 = (( 0,  0, -1),
>>>          ( 0,  0,  1),
>>>          ( 0, -1,  0),
>>>          ( 0,  1,  0),
>>>          (-1,  0,  0),
>>>          ( 1,  0,  0))
>>>
>>> shape = (100, 100, 100)
>>>
>>> g = hg.RegularGraph3d(shape, adj_6)
Parameters:
  • shape – list of int or embedding of the right dimension

  • neighbour_list – a list of points coordinates

Returns:

a regular graph instance

__new__(shape, neighbour_list)
__reduce__()

Helper for pickle.

adjacent_vertices(self: higra.higram.RegularGraph2d, vertex: int) Iterator[int]

Iterator over all vertices adjacent to the given vertex.

as_explicit_graph()

Converts the current regular graph instance to an equivalent explicit undirected graph.

Returns:

An UndirectedGraph equivalent to the current graph

degree(*args, **kwargs)

Overloaded function.

  1. degree(self: higra.higram.RegularGraph2d, vertex: int) -> int

Return the degree of the given vertex.

  1. degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.uint64]

Return the degree of the given vertices.

  1. degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint32]) -> numpy.ndarray[numpy.uint64]

  2. degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int64]) -> numpy.ndarray[numpy.uint64]

  3. degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint64]) -> numpy.ndarray[numpy.uint64]

in_degree(*args, **kwargs)

Overloaded function.

  1. in_degree(self: higra.higram.RegularGraph2d, vertex: int) -> int

Return the in degree of the given vertex.

  1. in_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.uint64]

Return the in degree of the given vertices.

  1. in_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint32]) -> numpy.ndarray[numpy.uint64]

  2. in_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int64]) -> numpy.ndarray[numpy.uint64]

  3. in_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint64]) -> numpy.ndarray[numpy.uint64]

in_edges(self: higra.higram.RegularGraph2d, vertex: int) Iterator[tuple]

Iterator over all in edges from ‘vertex’. An in edge is a tuple ‘(adjacent_vertex, vertex)’.

neighbour_list(self: higra.higram.RegularGraph2d) numpy.ndarray[numpy.int64]

Get the neighbour list defining the regular graph.

num_vertices(self: higra.higram.RegularGraph2d) int

Return the number of vertices in the graph

out_degree(*args, **kwargs)

Overloaded function.

  1. out_degree(self: higra.higram.RegularGraph2d, vertex: int) -> int

Return the out degree of the given vertex.

  1. out_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.uint64]

Return the out degree of the given vertices.

  1. out_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint32]) -> numpy.ndarray[numpy.uint64]

  2. out_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.int64]) -> numpy.ndarray[numpy.uint64]

  3. out_degree(self: higra.higram.RegularGraph2d, vertices_array: numpy.ndarray[numpy.uint64]) -> numpy.ndarray[numpy.uint64]

out_edges(self: higra.higram.RegularGraph2d, vertex: int) Iterator[tuple]

Iterator over all out edges from ‘vertex’. An out edge is a tuple ‘(vertex, adjacent_vertex)’.

shape(self: higra.higram.RegularGraph2d) numpy.ndarray[numpy.int64]

Get the shape of the grid graph.

source(self: higra.higram.RegularGraph2d, edge: tuple) detail::accessor<detail::accessor_policies::tuple_item>

Get the source vertex of an edge.

target(self: higra.higram.RegularGraph2d, edge: tuple) detail::accessor<detail::accessor_policies::tuple_item>

Get the target vertex of an edge.

vertices(self: higra.higram.RegularGraph2d) Iterator[int]

Iterator over all vertices of the graph.