Hypergraph (Hypergraph v1.0.0)
View SourceA module for creating and manipulating hypergraphs.
A hypergraph is a generalization of a graph where edges (hyperedges) can connect any number of vertices, not just two.
Summary
Functions
Adds a hyperedge to the hypergraph. The hyperedge connects all vertices in the given list. Automatically adds any new vertices to the hypergraph.
Checks if two vertices are connected by at least one hyperedge.
Returns the degree of a vertex (number of hyperedges containing it).
Returns the number of hyperedges in the hypergraph.
Returns the size of a hyperedge (number of vertices it contains).
Returns all hyperedges in the hypergraph.
Returns hyperedges that contain the given vertex.
Returns all vertices that share at least one hyperedge with the given vertex.
Creates a new empty hypergraph.
Creates a new hypergraph with the given vertices and hyperedges.
Removes a hyperedge from the hypergraph.
Removes a vertex from the hypergraph and all hyperedges containing it.
Returns statistics about the hypergraph.
Converts the hypergraph to a regular graph by creating pairwise edges for every pair of vertices that share a hyperedge.
Returns the number of vertices in the hypergraph.
Returns all vertices in the hypergraph.
Types
Functions
Adds a hyperedge to the hypergraph. The hyperedge connects all vertices in the given list. Automatically adds any new vertices to the hypergraph.
Checks if two vertices are connected by at least one hyperedge.
@spec degree(t(), vertex()) :: non_neg_integer()
Returns the degree of a vertex (number of hyperedges containing it).
@spec hyperedge_count(t()) :: non_neg_integer()
Returns the number of hyperedges in the hypergraph.
@spec hyperedge_size(hyperedge()) :: non_neg_integer()
Returns the size of a hyperedge (number of vertices it contains).
Returns all hyperedges in the hypergraph.
Returns hyperedges that contain the given vertex.
Returns all vertices that share at least one hyperedge with the given vertex.
@spec new() :: t()
Creates a new empty hypergraph.
Creates a new hypergraph with the given vertices and hyperedges.
Removes a hyperedge from the hypergraph.
Removes a vertex from the hypergraph and all hyperedges containing it.
Returns statistics about the hypergraph.
Converts the hypergraph to a regular graph by creating pairwise edges for every pair of vertices that share a hyperedge.
Returns a list of 2-element tuples representing edges.
@spec vertex_count(t()) :: non_neg_integer()
Returns the number of vertices in the hypergraph.
Returns all vertices in the hypergraph.