Skip to main content

FruchtermanReingoldOptions

Struct FruchtermanReingoldOptions 

Source
pub struct FruchtermanReingoldOptions<'a> {
    pub niter: usize,
    pub start_temp: Option<f64>,
    pub grid: LayoutGrid,
    pub weights: Option<&'a [f64]>,
    pub initial: Option<&'a Matrix>,
    pub minx: Option<&'a [f64]>,
    pub maxx: Option<&'a [f64]>,
    pub miny: Option<&'a [f64]>,
    pub maxy: Option<&'a [f64]>,
    pub minz: Option<&'a [f64]>,
    pub maxz: Option<&'a [f64]>,
}
Expand description

Parameters of the Fruchterman–Reingold layouts (Graph::layout_fruchterman_reingold and Graph::layout_fruchterman_reingold_3d).

The Default follows the igraph documentation: 500 iterations, a start temperature of sqrt(n) / 10, automatic grid selection, unit weights, a random start and no coordinate bounds.

use igraph::layout::FruchtermanReingoldOptions;
let weights = [1.0, 2.0, 3.0];
let opts = FruchtermanReingoldOptions { niter: 1000, ..Default::default() }
    .with_weights(&weights);
assert_eq!(opts.niter, 1000);

Fields§

§niter: usize

Number of iterations (default 500).

§start_temp: Option<f64>

Start temperature: the maximum movement of a vertex along one axis in one step; it decreases linearly to zero. None means sqrt(n) / 10.

§grid: LayoutGrid

Whether to use the faster, less accurate grid-based variant (2D only; LayoutGrid::AutoGrid, the default, uses it above 1000 vertices).

§weights: Option<&'a [f64]>

Positive edge weights multiplying the attraction along edges (higher weight: closer vertices; an isolated edge of weight w has length w^(-1/3)). None means unit weights.

§initial: Option<&'a Matrix>

Starting positions (n × 2, or n × 3 for the 3D version); None starts from a random layout.

§minx: Option<&'a [f64]>

Per-vertex minimum x coordinate (-inf means no bound).

§maxx: Option<&'a [f64]>

Per-vertex maximum x coordinate (+inf means no bound).

§miny: Option<&'a [f64]>

Per-vertex minimum y coordinate (-inf means no bound).

§maxy: Option<&'a [f64]>

Per-vertex maximum y coordinate (+inf means no bound).

§minz: Option<&'a [f64]>

Per-vertex minimum z coordinate (3D only).

§maxz: Option<&'a [f64]>

Per-vertex maximum z coordinate (3D only).

Implementations§

Source§

impl<'a> FruchtermanReingoldOptions<'a>

Source

pub fn with_weights(self, weights: &'a [f64]) -> Self

Sets the edge weights.

Source

pub fn with_initial(self, initial: &'a Matrix) -> Self

Sets the starting positions.

Source

pub fn with_niter(self, niter: usize) -> Self

Sets the number of iterations.

Trait Implementations§

Source§

impl<'a> Clone for FruchtermanReingoldOptions<'a>

Source§

fn clone(&self) -> FruchtermanReingoldOptions<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for FruchtermanReingoldOptions<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FruchtermanReingoldOptions<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> PartialEq for FruchtermanReingoldOptions<'a>

Source§

fn eq(&self, other: &FruchtermanReingoldOptions<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for FruchtermanReingoldOptions<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.