| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.98.0/docs/apis/_sources/weighted_graph_protocol_0.rst.txt |
.. index:: single: weighted_graph_protocol .. _weighted_graph_protocol/0:
.. rst-class:: right
protocol
weighted_graph_protocolProtocol for weighted graph predicates, extending the common graph protocol with weighted edge operations.
| Availability:
| logtalk_load(graphs(loader))
| Author: Paulo Moura | Version: 1:0:0 | Date: 2026-02-25
| Compilation flags:
| static
| Extends:
| public :ref:`graph_protocol <graph_protocol/0>`
| Remarks: | (none)
| Inherited public predicates: | Â :ref:`graph_protocol/0::add_edges/3` Â :ref:`graph_protocol/0::add_vertex/3` Â :ref:`graph_protocol/0::add_vertices/3` Â :ref:`graph_protocol/0::all_pairs_min_paths/2` Â :ref:`graph_protocol/0::all_pairs_min_predecessors/2` Â :ref:`graph_protocol/0::breadth_first_order/3` Â :ref:`graph_protocol/0::delete_edges/3` Â :ref:`graph_protocol/0::delete_vertex/3` Â :ref:`graph_protocol/0::delete_vertices/3` Â :ref:`graph_protocol/0::depth_first_order/3` Â :ref:`graph_protocol/0::edges/2` Â :ref:`graph_protocol/0::empty/1` Â :ref:`graph_protocol/0::has_path/3` Â :ref:`graph_protocol/0::is_bipartite/1` Â :ref:`graph_protocol/0::is_complete/1` Â :ref:`graph_protocol/0::is_sparse/1` Â :ref:`graph_protocol/0::max_path/5` Â :ref:`graph_protocol/0::min_distances/3` Â :ref:`graph_protocol/0::min_path/5` Â :ref:`graph_protocol/0::min_predecessors/3` Â :ref:`graph_protocol/0::neighbors/3` Â :ref:`graph_protocol/0::new/1` Â :ref:`graph_protocol/0::new/2` Â :ref:`graph_protocol/0::new/3` Â :ref:`graph_protocol/0::number_of_edges/2` Â :ref:`graph_protocol/0::number_of_vertices/2` Â :ref:`graph_protocol/0::path/3` Â :ref:`graph_protocol/0::reachable/3` Â :ref:`graph_protocol/0::vertices/2` Â
.. contents:: :local: :backlinks: top
.. index:: edge/4 .. _weighted_graph_protocol/0::edge/4:
edge/4 ^^^^^^^^^^
True iff there is an edge between Vertex1 and Vertex2 with weight Weight in Graph.
| Compilation flags:
| static
| Template:
| edge(Vertex1,Vertex2,Weight,Graph)
| Mode and number of proofs:
| edge(+vertex,+vertex,?number,+graph) - zero_or_one
.. index:: add_edge/5 .. _weighted_graph_protocol/0::add_edge/5:
add_edge/5 ^^^^^^^^^^^^^^
Adds a weighted edge between Vertex1 and Vertex2 with weight Weight.
| Compilation flags:
| static
| Template:
| add_edge(Graph,Vertex1,Vertex2,Weight,NewGraph)
| Mode and number of proofs:
| add_edge(+graph,+vertex,+vertex,+number,-graph) - one
.. index:: delete_edge/5 .. _weighted_graph_protocol/0::delete_edge/5:
delete_edge/5 ^^^^^^^^^^^^^^^^^
Deletes the weighted edge between Vertex1 and Vertex2. Unifies Weight with the weight of the deleted edge. The graph is unchanged if the edge does not exist.
| Compilation flags:
| static
| Template:
| delete_edge(Graph,Vertex1,Vertex2,Weight,NewGraph)
| Mode and number of proofs:
| delete_edge(+graph,+vertex,+vertex,?number,-graph) - one
.. index:: wneighbors/3 .. _weighted_graph_protocol/0::wneighbors/3:
wneighbors/3 ^^^^^^^^^^^^^^^^
Unifies WNeighbors with a list of NeighborVertex-Weight pairs for the neighbors of Vertex. Fails if Vertex is not in the graph.
| Compilation flags:
| static
| Template:
| wneighbors(Vertex,Graph,WNeighbors)
| Mode and number of proofs:
| wneighbors(+vertex,+graph,-list(pair)) - zero_or_one
.. index:: min_path_bellman_ford/5 .. _weighted_graph_protocol/0::min_path_bellman_ford/5:
min_path_bellman_ford/5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Finds the minimum cost path from Vertex1 to Vertex2 using the Bellman-Ford algorithm. Supports negative edge weights and fails if no path exists or if a reachable negative cycle makes the optimum undefined.
| Compilation flags:
| static
| Template:
| min_path_bellman_ford(Vertex1,Vertex2,Graph,Path,Cost)
| Mode and number of proofs:
| min_path_bellman_ford(+vertex,+vertex,+graph,-list(vertex),-number) - zero_or_one
.. index:: has_negative_cycle/1 .. _weighted_graph_protocol/0::has_negative_cycle/1:
has_negative_cycle/1 ^^^^^^^^^^^^^^^^^^^^^^^^
True iff Graph contains a negative-weight cycle.
| Compilation flags:
| static
| Template:
| has_negative_cycle(Graph)
| Mode and number of proofs:
| has_negative_cycle(+graph) - zero_or_one
(no local declarations; see entity ancestors if any)
(no local declarations; see entity ancestors if any)
(none)