Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error while computing gomory hu tree of graph using LP

Hello,

I have an issue with the Gomory Hu tree computation and hope that someone can help me. I load a graph and pass it to the gomory hu tree computation function using the algorithm „LP“, after around 10 seconds I get the following error and the computation aborts.

Traceback (most recent call last):
  File ".../treewidth-playground/main.py", line 13, in <module>
    hu = graph.gomory_hu_tree(algorithm="LP")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/sage2/lib/python3.11/site-packages/sage/graphs/graph.py", line 8697, in gomory_hu_tree
    g = self._gomory_hu_tree(frozenset(self.vertex_iterator()), algorithm=algorithm)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/sage2/lib/python3.11/site-packages/sage/graphs/graph.py", line 8579, in _gomory_hu_tree
    for uu, vv, capacity in edges:
        ^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 2)

an executable example can be found here under the tag „Sage_question_01“: https:// gitlab.com/Telijas/treewidth-playground/-/blob/Sage_question_01/main.py?ref_type=tags

The applications basically consists of loading the graph and applying the algorithm:

import load.file_loader as file_loader
import processing.process
from sage.all import *

# file_name = "./resources/USA-road-d.NY.gr"
file_name = "./resources/AProVE07-03.gaifman.gr"


graph = file_loader.load(file_name)
print("Vertices found:", graph.order(), "and edges:", graph.size())
print("Start computation of gomory hu")
hu = graph.gomory_hu_tree(algorithm="LP")
print("Done computation of gomory hu")
print("Done")

Error while computing gomory hu tree of graph using LP

Hello,

I have an issue with the Gomory Hu tree computation and hope that someone can help me. I load a graph and pass it to the gomory hu tree computation function using the algorithm „LP“, after around 10 seconds I get the following error and the computation aborts.

Traceback (most recent call last):
  File ".../treewidth-playground/main.py", line 13, in <module>
    hu = graph.gomory_hu_tree(algorithm="LP")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/sage2/lib/python3.11/site-packages/sage/graphs/graph.py", line 8697, in gomory_hu_tree
    g = self._gomory_hu_tree(frozenset(self.vertex_iterator()), algorithm=algorithm)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/sage2/lib/python3.11/site-packages/sage/graphs/graph.py", line 8579, in _gomory_hu_tree
    for uu, vv, capacity in edges:
        ^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 2)

an executable example can be found here under the tag „Sage_question_01“: https:// gitlab.com/Telijas/treewidth-playground/-/blob/Sage_question_01/main.py?ref_type=tags https://gitlab.com/Telijas/treewidth-playground/-/blob/Sage_question_01/main.py?ref_type=tags

The applications basically consists of loading the graph and applying the algorithm:

import load.file_loader as file_loader
import processing.process
from sage.all import *

# file_name = "./resources/USA-road-d.NY.gr"
file_name = "./resources/AProVE07-03.gaifman.gr"


graph = file_loader.load(file_name)
print("Vertices found:", graph.order(), "and edges:", graph.size())
print("Start computation of gomory hu")
hu = graph.gomory_hu_tree(algorithm="LP")
print("Done computation of gomory hu")
print("Done")