networkit.viz

class networkit.viz.GraphLayoutAlgorithm

Bases: object

Abstract base class for graph drawing algorithms.

getCoordinates()

Computes approximation (in parallel) of the Spanning Edge Centrality.

Returns:

List of coordinates for each node.

Return type:

list(tuple(float, float))

numEdgeCrossings()

Computes approximation (in parallel) of the Spanning Edge Centrality.

Returns:

Number of edge crossings.

Return type:

int

run()

Executes the graph layout algorithm.

Returns:

self

Return type:

networkit.viz.GraphLayoutAlgorithm

writeGraphToGML(path)

Writes the graph and its layout to a .gml file at the specified path.

Parameters:

path (str) – Path where the graph file should be created.

writeKinemage(path)

Writes the graph and its layout to a file at the specified path.

Parameters:

path (str) – Path where the graph file should be created.

class networkit.viz.MaxentStress(G, dim, k, coordinates=list(), tolerance=1e-5, linearSolverType=networkit.viz.LinearSolverType.LAMG, fastComputation=False, graphDistance=networkit.viz.GraphDistance.EDGE_WEIGHT)

Bases: GraphLayoutAlgorithm

Implementation of MaxentStress by Gansner et al. using a Laplacian system solver. @see Gansner, Emden R., Yifan Hu, and Steve North. “A maxent-stress model for graph layout.” Visualization and Computer Graphics, IEEE Transactions on 19, no. 6 (2013): 927-940.

Parameter graphDistance can be one of the following:

  • networkit.viz.GraphDistance.EdgeWeight

  • networkit.viz.GraphDistance.AlgebraicDistance

Parameter linearSolverType can be one of the following:

  • networkit.viz.LinearSolverType.LAMG

  • networkit.viz.LinearSolverType.CONJUGATE_GRADIENT_IDENTITY_PRECONDITIONER

  • networkit.viz.LinearSolverType.CONJUGATE_GRADIENT_DIAGONAL_PRECONDITIONER

Parameters:
  • G (networkit.Graph) – The (connected) graph to be handled.

  • dim (int) – Number of dimensions.

  • k (int) – Node distance to take into account for computation. The higher k, the longer computation takes to complete.

  • coordinates (list(tuple(float, float)), optional) – Fixed coordinates. Default: list()

  • tolerance (float, optional) – The tolerance of the solver. Default: 1e-5

  • linearSolverType (networkit.viz.LinearSolverType, optional) – The type of linear solver. Default: networkit.viz.LinearSolverType.LAMG

  • fastComputation (bool, optional) – Decides whether or not slightly faster computation should be employed, leading to slightly worse results. Default: False

  • graphDistance (networkit.viz.GraphDistance, optional) – Decides what type of graph distance should be utilised. Default: networkit.community.GraphDistance.EdgeWeight

computeScalingFactor()

Computes a scalar s s.t. \(\sum_{u,v \in V} w_{uv} (s ||x_u - x_v|| - d_{uv}||)^2\) is minimized.

fullStressMeasure()

Computes the full stress measure of the computed layout with run().

getApproxEntropyTerm()

Returns entropy term value.

Returns:

The parameter value.

Return type:

float

getRhs()

Returns rhs value.

Returns:

The parameter value.

Return type:

float

getSolveTime()

Returns solve time value.

Returns:

The parameter value.

Return type:

float

ldme()

Computes the ldme.

maxentMeasure()

Computes the maxent stress measure for the computed layout with run().

meanDistanceError()

Computes mean distance error.

scaleLayout()

Scale the layout computed by run() by a scalar s to minimize \(\sum_{u,v \in V} w_{uv} (s ||x_u - x_v|| - d_{uv}||)^2\).

setAlpha(alpha)

Set parameter alpha.

Parameters:

alpha (float) – New parameter value.

setAlphaReduction(alphaReduction)

Set parameter alphaReduction.

Parameters:

alphaReduction (float) – New parameter value.

setConvergenceThreshold(convThreshold)

Set parameter convThreshold.

Parameters:

convThreshold (float) – New parameter value.

setFinalAlpha(finalAlpha)

Set parameter finalAlpha.

Parameters:

finalAlpha (float) – New parameter value.

setQ(q)

Set parameter q.

Parameters:

q (float) – New parameter value.

class networkit.viz.PivotMDS(dim, numberOfPivots)

Bases: GraphLayoutAlgorithm

Implementation of PivotMDS proposed by Brandes and Pich.

Parameters:
  • G (networkit.Graph) – The graph to be handled by the algorithm.

  • dim (int) – Number of dimensions.

  • numberOfPivots (int) – Number of pivots for the algorithm.