rgg v1.0.0 RGG.Shared

Link to this section Summary

Functions

This function connects nodes to their appropriate neighbors

This function maps nodes into their appropriate buckets before connection

This function returns the nodes that must be tested in order to connect a node in the graph

This function selects the proper bucket numbers for a node based on it’s x location, y location, and the number of buckets

iex>RGG.Shared.get_bucket_from_node(%RGG.Node{x: 0, y: 0}, 10)
{0, 0}
iex>RGG.Shared.get_bucket_from_node(%RGG.Node{x: 1, y: 0.5}, 10)
{10, 5}

This function calculates the maximum number of buckets we can use when connecting nodes to achieve linear runtime when connecting the nodes.. The only parameter is r as we need to make sure we place nodes within radius r of each other within 1 bucket of each other.

Examples

iex>RGG.Square.calculate_radius_square(1000, 25) |> RGG.Shared.num_buckets()
10

Link to this section Functions

Link to this function connect_to_neighbors(node, buckets, r)

This function connects nodes to their appropriate neighbors

Link to this function create_buckets(nodes, number_of_buckets)

This function maps nodes into their appropriate buckets before connection.

Link to this function curry_put_node_in_bucket(n)
Link to this function get_adjacent_nodes_for_bucket(node, buckets)

This function returns the nodes that must be tested in order to connect a node in the graph.

Link to this function get_bucket_from_node(node, number_buckets)

This function selects the proper bucket numbers for a node based on it’s x location, y location, and the number of buckets

iex>RGG.Shared.get_bucket_from_node(%RGG.Node{x: 0, y: 0}, 10)
{0, 0}
iex>RGG.Shared.get_bucket_from_node(%RGG.Node{x: 1, y: 0.5}, 10)
{10, 5}

This function calculates the maximum number of buckets we can use when connecting nodes to achieve linear runtime when connecting the nodes.. The only parameter is r as we need to make sure we place nodes within radius r of each other within 1 bucket of each other.

Examples

iex>RGG.Square.calculate_radius_square(1000, 25) |> RGG.Shared.num_buckets()
10