Layout#

template<typename vertex_t, typename edge_t, typename weight_t>
void force_atlas2(raft::handle_t const &handle, raft::random::RngState &rng_state, legacy::GraphCOOView<vertex_t, edge_t, weight_t> &graph, float *pos, const int max_iter = 500, float *x_start = nullptr, float *y_start = nullptr, bool outbound_attraction_distribution = true, bool lin_log_mode = false, bool prevent_overlapping = false, float *vertex_radius_values = nullptr, const float overlap_scaling_ratio = 100.0, const float edge_weight_influence = 1.0, const float jitter_tolerance = 1.0, bool barnes_hut_optimize = true, const float barnes_hut_theta = 0.5, const float scaling_ratio = 2.0, bool strong_gravity_mode = false, const float gravity = 1.0, float *vertex_mobility_values = nullptr, bool verbose = false, internals::GraphBasedDimRedCallback *callback = nullptr)#

ForceAtlas2 is a continuous graph layout algorithm for handy network visualization.

                                         NOTE: Peak memory allocation occurs at 17*V.
Throws:

cugraph::logic_error – when an error occurs.

Template Parameters:
  • vertex_t – Type of vertex identifiers. Supported value : int (signed, 32-bit)

  • edge_t – Type of edge identifiers. Supported value : int (signed, 32-bit)

  • weight_t – Type of edge weights. Supported values : float or double.

Parameters:
  • handle[in] Library handle (RAFT). If a communicator is set in the handle, the multi GPU version will be selected.

  • rng_state[in] The RngState instance holding pseudo-random number generator state.

  • graph[in] cuGraph graph descriptor, should contain the connectivity information as a COO. Graph is considered undirected. Edge weights are used for this algorithm and set to 1 by default.

  • pos[out] Device array (2, n) containing x-axis and y-axis positions;

  • max_iter[in] The maximum number of iterations Force Atlas 2 should run for.

  • x_start[in] Device array containing starting x-axis positions;

  • y_start[in] Device array containing starting y-axis positions;

  • outbound_attraction_distribution[in] Distributes attraction along outbound edges. Hubs attract less and thus are pushed to the borders.

  • lin_log_mode[in] Switch ForceAtlas’ model from lin-lin to lin-log (tribute to Andreas Noack). Makes clusters more tight.

  • prevent_overlapping[in] Prevent nodes from overlapping.

  • vertex_radius_values[in] Radius of each vertex, used when prevent_overlapping is set.

  • overlap_scaling_ratio[in] When prevent_overlapping is set, scales the repulsion force between two nodes that are overlapping.

  • edge_weight_influence[in] How much influence you give to the edges weight. 0 is “no influence” and 1 is “normal”.

  • jitter_tolerance[in] How much swinging you allow. Above 1 discouraged. Lower gives less speed and more precision.

  • barnes_hut_optimize[in] Whether to use the Barnes Hut approximation or the slower exact version.

  • barnes_hut_theta[in] Float between 0 and 1. Tradeoff for speed (1) vs accuracy (0) for Barnes Hut only.

  • scaling_ratio[in] Float strictly positive. How much repulsion you want. More makes a more sparse graph. Switching from regular mode to LinLog mode needs a readjustment of the scaling parameter.

  • strong_gravity_mode[in] Sets a force that attracts the nodes that are distant from the center more. It is so strong that it can sometimes dominate other forces.

  • gravity[in] Attracts nodes to the center. Prevents islands from drifting away.

  • vertex_mobility_values[in] Device array containing mobility of each vertex (scaling factor for the displacement at each iteration).

  • verbose[in] Output convergence info at each interation.

  • callback[in] An instance of GraphBasedDimRedCallback class to intercept the internal state of positions while they are being trained.