Zog.Property (Zog v0.4.0)
View SourceNative graph properties backed by Zog (Zig) via Zigler.
Summary
Functions
Finds all maximal cliques using native Bron-Kerbosch.
Checks if the graph is an arborescence (directed tree with a single root).
Finds the root label of an arborescence, or nil if none exists.
Checks if a directed graph is a branching (directed forest).
Computes graph coloring using the DSatur heuristic natively.
Returns {chromatic_number, %{node_label => color}}.
Computes exact graph coloring natively using backtracking with pruning.
Checks if the graph is a complete graph (K_n).
Finds an Eulerian circuit in the graph using Hierholzer's algorithm.
Finds an Eulerian path in the graph using Hierholzer's algorithm.
Finds node mapping dict %{g1_label => g2_label} if isomorphic, or nil.
Checks if the graph is a forest.
Checks if the graph contains an Eulerian circuit.
Checks if the graph contains an Eulerian path.
Calculates the Weisfeiler-Lehman (WL) structural graph hash.
Checks if two graphs are isomorphic using exact VF2 matching.
Finds the maximum clique using native Bron-Kerbosch.
Checks if the graph is k-regular.
Checks if the graph is a tree.
Functions
@spec all_maximal_cliques(Zog.SoA.t()) :: [MapSet.t(Zog.SoA.label())]
Finds all maximal cliques using native Bron-Kerbosch.
@spec all_maximal_cliques( 0..18_446_744_073_709_551_615, [0..4_294_967_295] | <<_::_*32>>, [0..4_294_967_295] | <<_::_*32>>, [float()] | <<_::_*64>> ) :: [[0..4_294_967_295]]
Checks if the graph is an arborescence (directed tree with a single root).
Finds the root label of an arborescence, or nil if none exists.
Checks if a directed graph is a branching (directed forest).
@spec coloring_dsatur(Zog.SoA.t()) :: {non_neg_integer(), %{required(Zog.SoA.label()) => non_neg_integer()}}
Computes graph coloring using the DSatur heuristic natively.
Returns {chromatic_number, %{node_label => color}}.
@spec coloring_exact(Zog.SoA.t(), non_neg_integer()) :: {:ok, non_neg_integer(), %{required(Zog.SoA.label()) => non_neg_integer()}} | {:timeout, {non_neg_integer(), %{required(Zog.SoA.label()) => non_neg_integer()}}}
Computes exact graph coloring natively using backtracking with pruning.
Checks if the graph is a complete graph (K_n).
@spec eulerian_circuit( Zog.SoA.t() | struct(), keyword() ) :: {:ok, [Zog.SoA.label()]} | {:error, :no_eulerian_circuit}
Finds an Eulerian circuit in the graph using Hierholzer's algorithm.
@spec eulerian_path( Zog.SoA.t() | struct(), keyword() ) :: {:ok, [Zog.SoA.label()]} | {:error, :no_eulerian_path}
Finds an Eulerian path in the graph using Hierholzer's algorithm.
Finds node mapping dict %{g1_label => g2_label} if isomorphic, or nil.
Checks if the graph is a forest.
Checks if the graph contains an Eulerian circuit.
Checks if the graph contains an Eulerian path.
Calculates the Weisfeiler-Lehman (WL) structural graph hash.
Provides a structural graph hash that iteratively gathers and sorts neighbor labels to construct a deterministic characteristic signature evaluating isomorphism.
Options
:iterations- The number of message-passing iterations (default: 3).:node_label_fn- Custom function(graph, node -> String.t())mapping nodes to initial labels.
Examples
iex> g1 = Zog.undirected() |> Zog.add_edge("a", "b", 1.0) |> Zog.add_edge("b", "c", 1.0)
iex> g2 = Zog.undirected() |> Zog.add_edge(1, 2, 1.0) |> Zog.add_edge(2, 3, 1.0)
iex> Zog.Property.hash(g1) == Zog.Property.hash(g2)
true
Checks if two graphs are isomorphic using exact VF2 matching.
@spec max_clique(Zog.SoA.t()) :: MapSet.t(Zog.SoA.label())
Finds the maximum clique using native Bron-Kerbosch.
@spec nif_dsatur( 0..18_446_744_073_709_551_615, [0..4_294_967_295] | <<_::_*32>>, [0..4_294_967_295] | <<_::_*32>>, [float()] | <<_::_*64>> ) :: [0..4_294_967_295]
Checks if the graph is k-regular.
Checks if the graph is a tree.