edges

Class(es) for building/connecting graphs.

class graphnet.models.graphs.edges.edges.EdgeDefinition(*args, **kwargs)[source]

Bases: Model

Base class for graph building.

Construct Logger.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

object

forward(graph)[source]

Construct edges based on problem specific implementation of.

´_construct_edges´

Parameters:

graph (Data) – a graph without edges

Returns:

a graph with edges

Return type:

graph

class graphnet.models.graphs.edges.edges.KNNEdges(*args, **kwargs)[source]

Bases: EdgeDefinition

Builds edges from the k-nearest neighbours.

K-NN Edge definition.

Will connect nodes together with their ´nb_nearest_neighbours´ nearest neighbours in the feature space given by ´columns´.

Parameters:
  • nb_nearest_neighbours (int) – number of neighbours.

  • columns (List[int], default: [0, 1, 2]) – Node features to use for distance calculation.

  • [0 (Defaults to)

  • 1

  • 2].

  • args (Any)

  • kwargs (Any)

Return type:

object

class graphnet.models.graphs.edges.edges.RadialEdges(*args, **kwargs)[source]

Bases: EdgeDefinition

Builds graph from a sphere of chosen radius centred at each node.

Radial edges.

Connects each node to other nodes that are within a sphere of radius ´r´ centered at the node. The feature space of ´r´ is defined by ´columns´

Parameters:
  • radius (float) – radius of sphere

  • columns (List[int], default: [0, 1, 2]) – columns of the node feature matrix used.

  • [0 (Defaults to)

  • 1

  • 2].

  • args (Any)

  • kwargs (Any)

Return type:

object

class graphnet.models.graphs.edges.edges.EuclideanEdges(*args, **kwargs)[source]

Bases: EdgeDefinition

Builds edges according to Euclidean distance between nodes.

See https://arxiv.org/pdf/1809.06166.pdf.

Construct EuclideanEdges.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

object