pylibcugraph.force_atlas2#
- pylibcugraph.force_atlas2(
- ResourceHandle resource_handle,
- random_state,
- _GPUGraph graph,
- int max_iter,
- start_vertices,
- x_start,
- y_start,
- bool_t outbound_attraction_distribution,
- bool_t lin_log_mode,
- bool_t prevent_overlapping,
- vertex_radius_vertices,
- vertex_radius_values,
- double overlap_scaling_ratio,
- double edge_weight_influence,
- double jitter_tolerance,
- bool_t barnes_hut_optimize,
- double barnes_hut_theta,
- double scaling_ratio,
- bool_t strong_gravity_mode,
- double gravity,
- vertex_mobility_vertices,
- vertex_mobility_values,
- vertex_mass_vertices,
- vertex_mass_values,
- bool_t verbose,
- bool_t do_expensive_check,
ForceAtlas2 is a continuous graph layout algorithm for handy network visualization.
- Parameters:
- resource_handleResourceHandle
Handle to the underlying device resources needed for referencing data and running algorithms.
- random_stateint , optional
Random state to use when generating samples. Optional argument, defaults to a hash of process id, time, and hostname. (See pylibcugraph.random.CuGraphRandomState)
- graphSGGraph or MGGraph
The input graph, for either Single or Multi-GPU operations.
- max_iter: int
Maximum number of Katz Centrality iterations
- start_verticesdevice array type, optional (default=None)
Vertices of graph for x_start and y_start
- x_startdevice array type, optional (default=None)
Initial vertex positioning (x-axis)
- y_startdevice array type, optional (default=None)
Initial vertex positioning (y-axis)
- outbound_attraction_distributionbool_t
Distributes attraction along outbound edges Hubs attract less and thus are pushed to the borders.
- lin_log_modebool_t
Switch Force Atlas model from lin-lin to lin-log. Makes clusters more tight.
- prevent_overlappingbool_t
Prevent nodes to overlap.
- vertex_radius_verticesdevice array type, optional (default=None)
Vertices of graph for vertex_radius_values.
- vertex_radius_valuesdevice array type, optional (default=None)
Radius of each vertex, used when prevent_overlapping is set.
- overlap_scaling_ratiodouble
When prevent_overlapping is set, scales the repulsion force between two nodes that are overlapping.
- edge_weight_influencedouble
How much influence you give to the edges weight. 0 is “no influence” and 1 is “normal”.
- jitter_tolerancedouble
How much swinging you allow. Above 1 discouraged. Lower gives less speed and more precision.
- barnes_hut_optimizebool_t
Whether to use the Barnes Hut approximation or the slower exact version.
- barnes_hut_thetadouble
Float between 0 and 1. Tradeoff for speed (1) vs accuracy (0) for Barnes Hut only.
- scaling_ratiodouble
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_modebool_t
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.
- gravitydouble
Attracts nodes to the center. Prevents islands from drifting away.
- vertex_mobility_verticesdevice array type, optional (default=None)
Vertices of graph for vertex_mobility_values.
- vertex_mobility_valuesdevice array type, optional (default=None)
Mobility of each vertex, scaling its speed in each iteration. If not provided, all vertices will have a mobility of 1.0.
- vertex_mass_verticesdevice array type, optional (default=None)
Vertices of graph for vertex_mass_values.
- vertex_mass_valuesdevice array type, optional (default=None)
Mass of each vertex, which controls the attraction to other vertices. If not provided, the mass of each vertex will be its degree plus one.
- verbosebool_t
Output convergence info at each interation.
- do_expensive_checkbool_t
A flag to run expensive checks for input arguments (if set to true)
- callback: # FIXME: NOT IMPLEMENTED YET
intercept the internal state of positions while they are being trained.
- Returns:
- return the position of each vertices
Examples
>>> import pylibcugraph, cupy, numpy >>> srcs = cupy.asarray([0, 1, 1, 2, 2, 2, 3, 3, 4], dtype=numpy.int32) >>> dsts = cupy.asarray([1, 3, 4, 0, 1, 3, 4, 5, 5], dtype=numpy.int32) >>> weights = cupy.asarray( ... [0.1, 2.1, 1.1, 5.1, 3.1, 4.1, 7.2, 3.2, 6.1], dtype=numpy.float32) >>> resource_handle = pylibcugraph.ResourceHandle() >>> graph_props = pylibcugraph.GraphProperties(is_symmetric=False, is_multigraph=False) >>> G = pylibcugraph.SGGraph( ... resource_handle, graph_props, srcs, dsts, weight_array=weights, ... store_transposed=False, renumber=False, do_expensive_check=False) >>> (vertices, x_axis, y_axis) = pylibcugraph.force_atlas2( ... resource_handle, 42, G, 500, None, None, None, True, False, False, ... None, None, 100.0, 1.0, 1.0, False, 0.5, 2.0, False, 1.0, None, None, ... None, None, False, False) >>> vertices [ 0 1 2 3 4 5 ] >>> x_axis [-7.7015705 7.6763854 -2.7651896 -0.02446137 1.6971487 -1.2822613 ] >>> y_axis [ 23.276543 7.9067745 13.618961 -0.07172047 -6.8321953 -11.90544 ]