Zog.Centrality (Zog v0.4.0)

View Source

Native centrality algorithms backed by Zog (Zig) via Zigler.

Summary

Functions

Calculates Alpha Centrality for all nodes.

Calculates weighted Betweenness Centrality for all nodes.

Calculates unweighted Betweenness Centrality for all nodes.

Calculates Closeness Centrality for all nodes.

Calculates Eigenvector Centrality for all nodes.

Calculates Harmonic Centrality for all nodes.

Calculates HITS hub and authority scores for all nodes natively.

Calculates Katz Centrality for all nodes.

Calculates PageRank centrality for all nodes.

Functions

alpha_centrality(builder, opts \\ [])

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

Calculates Alpha Centrality for all nodes.

alpha_centrality(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

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

betweenness_f64(builder)

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

Calculates weighted Betweenness Centrality for all nodes.

betweenness_f64(arg1, arg2, arg3, arg4)

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

betweenness_unweighted(builder)

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

Calculates unweighted Betweenness Centrality for all nodes.

betweenness_unweighted(arg1, arg2, arg3)

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

closeness_f64(builder)

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

Calculates Closeness Centrality for all nodes.

closeness_f64(arg1, arg2, arg3, arg4)

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

eigenvector(builder, opts \\ [])

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

Calculates Eigenvector Centrality for all nodes.

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

@spec eigenvector(
  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,
  float()
) :: [float()]

harmonic_centrality_f64(builder)

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

Calculates Harmonic Centrality for all nodes.

harmonic_centrality_f64(arg1, arg2, arg3, arg4)

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

hits(graph, opts \\ [])

@spec hits(
  Zog.SoA.t() | struct(),
  keyword()
) :: %{
  hubs: %{required(Zog.SoA.label()) => float()},
  authorities: %{required(Zog.SoA.label()) => float()}
}

Calculates HITS hub and authority scores for all nodes natively.

Returns %{hubs: %{label => score}, authorities: %{label => score}}.

Options

  • :max_iterations - Maximum power iterations (default: 100).
  • :tolerance - Convergence threshold for L2 norm (default: 1.0e-6).

katz(builder, opts \\ [])

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

Calculates Katz Centrality for all nodes.

katz(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

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

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

@spec nif_hits(
  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,
  float()
) :: term()

pagerank(builder, opts \\ [])

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

Calculates PageRank centrality for all nodes.

pagerank(arg1, arg2, arg3, arg4, arg5, arg6, arg7)

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