Yog.Multi (YogEx v0.97.0)

Copy Markdown View Source

Unified facade for multigraph operations.

Multigraphs allow multiple (parallel) edges between the same pair of nodes. This module provides creation, modification, traversal, and algorithmic analysis for multigraphs by delegating to specialized submodules.

Summary

Functions

Adds an edge to the multigraph, returning {updated_graph, edge_id}.

Adds a node to the multigraph.

Returns all edge IDs in the graph.

Returns all node IDs in the multigraph.

Performs a Breadth-First Search from source.

Performs a Depth-First Search from source.

Creates a new empty directed multigraph.

Returns all parallel edges between from and to as [{edge_id, data}].

Finds an Eulerian circuit using Hierholzer's algorithm.

Finds an Eulerian path using Hierholzer's algorithm.

Folds over nodes during multigraph traversal with metadata.

Checks if the multigraph has an Eulerian circuit.

Checks if the multigraph has an Eulerian path.

Returns the in-degree of a node.

Creates a new empty multigraph of the given type.

Returns the number of nodes.

Returns the out-degree of a node.

Returns all incoming edges to id as [{from_node, edge_id, data}].

Removes a single edge by its EdgeId.

Removes a node and all edges connected to it.

Returns the total number of edges.

Returns all outgoing edges from id as [{to_node, edge_id, data}].

Collapses the multigraph into a simple graph using a combining function.

Creates a new empty undirected multigraph.

Functions

add_edge(graph, from, to, data)

Adds an edge to the multigraph, returning {updated_graph, edge_id}.

add_node(graph, id, data)

Adds a node to the multigraph.

all_edge_ids(graph)

Returns all edge IDs in the graph.

all_nodes(graph)

Returns all node IDs in the multigraph.

bfs(graph, source)

Performs a Breadth-First Search from source.

dfs(graph, source)

Performs a Depth-First Search from source.

directed()

Creates a new empty directed multigraph.

edges_between(graph, from, to)

Returns all parallel edges between from and to as [{edge_id, data}].

find_eulerian_circuit(graph)

Finds an Eulerian circuit using Hierholzer's algorithm.

find_eulerian_path(graph)

Finds an Eulerian path using Hierholzer's algorithm.

fold_walk(graph, from, initial, folder)

Folds over nodes during multigraph traversal with metadata.

has_eulerian_circuit?(graph)

Checks if the multigraph has an Eulerian circuit.

has_eulerian_path?(graph)

Checks if the multigraph has an Eulerian path.

in_degree(graph, id)

Returns the in-degree of a node.

new(kind)

Creates a new empty multigraph of the given type.

order(graph)

Returns the number of nodes.

out_degree(graph, id)

Returns the out-degree of a node.

predecessors(graph, id)

Returns all incoming edges to id as [{from_node, edge_id, data}].

remove_edge(graph, edge_id)

Removes a single edge by its EdgeId.

remove_node(graph, id)

Removes a node and all edges connected to it.

size(graph)

Returns the total number of edges.

successors(graph, id)

Returns all outgoing edges from id as [{to_node, edge_id, data}].

to_simple_graph(graph, combine_fn)

Collapses the multigraph into a simple graph using a combining function.

undirected()

Creates a new empty undirected multigraph.