Zog.Metrics (Zog v0.3.0)

View Source

Native graph metrics backed by Zog (Zig) via Zigler.

Summary

Functions

Computes the Approximate Neighborhood Function (ANF) and effective diameter. Returns {:ok, %{neighborhood_sizes: [float()], effective_diameter: float()}} or {:error, any()}.

Computes degree assortativity.

Computes the average clustering coefficient.

Computes graph density.

Computes the local clustering coefficient for each node.

Counts the number of triangles in the graph.

Functions

anf(builder, opts \\ [])

@spec anf(
  Zog.SoA.t(),
  keyword()
) ::
  {:ok, %{neighborhood_sizes: [float()], effective_diameter: float()}}
  | {:error, any()}

Computes the Approximate Neighborhood Function (ANF) and effective diameter. Returns {:ok, %{neighborhood_sizes: [float()], effective_diameter: float()}} or {:error, any()}.

Options

  • :max_steps - Maximum number of steps to traverse (defaults to 30).
  • :m - Number of registers (trials) per node (defaults to 64).

assortativity(builder)

@spec assortativity(Zog.SoA.t()) :: float()

Computes degree assortativity.

assortativity(arg1, arg2, arg3, arg4)

@spec assortativity(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: float()

average_clustering_coefficient(builder)

@spec average_clustering_coefficient(Zog.SoA.t()) :: float()

Computes the average clustering coefficient.

average_clustering_coefficient(arg1, arg2, arg3, arg4)

@spec average_clustering_coefficient(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: float()

density(builder)

@spec density(Zog.SoA.t()) :: float()

Computes graph density.

density(arg1, arg2, arg3, arg4)

@spec density(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: float()

local_clustering_coefficient(builder)

@spec local_clustering_coefficient(Zog.SoA.t()) :: %{
  required(Zog.SoA.label()) => float()
}

Computes the local clustering coefficient for each node.

local_clustering_coefficient(arg1, arg2, arg3, arg4)

@spec local_clustering_coefficient(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: [float()]

nif_anf(arg1, arg2, arg3, arg4, arg5, arg6)

@spec nif_anf(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>,
  0..18_446_744_073_709_551_615,
  0..18_446_744_073_709_551_615
) :: term()

triangle_count(builder)

@spec triangle_count(Zog.SoA.t()) :: non_neg_integer()

Counts the number of triangles in the graph.

triangle_count(arg1, arg2, arg3, arg4)

@spec triangle_count(
  0..18_446_744_073_709_551_615,
  [0..4_294_967_295] | <<_::_*32>>,
  [0..4_294_967_295] | <<_::_*32>>,
  [float()] | <<_::_*64>>
) :: 0..18_446_744_073_709_551_615