Skip to content
Snippets Groups Projects
Commit d2757602 authored by Dominik Krupke's avatar Dominik Krupke
Browse files

Merge branch 'main' of gitlab.ibr.cs.tu-bs.de:alg/algorithms-lab-ss2023

parents 1d361b6f 3e8babdd
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -103,8 +103,8 @@ class FeedbackVertexSetSolverSAT():
k = len(best_solution)
print(f"A greedy solution of size {k} was found!")
ub = k # the lowest number of vertices that are proven to build a FVS
lb = 0 # the lowest number of vertices that might still build a FVS (not proven wrong)
ub = k # the lowest number of vertices that are proven to form a FVS
lb = 0 # the lowest number of vertices that might still form a FVS (not proven wrong)
while lb < ub:
k = (lb + ub) // 2 # integer division (discards floating point decimals)
......
......@@ -41,9 +41,9 @@ def visualize_fvs(graph: nx.Graph, feedback_vertex_set: Set[Node]):
Draws a 'before-after' visualization of a given Feedback Vertex Set solution on a given graph.
"""
layout = nx.layout.kamada_kawai_layout(graph)
nx.draw_networkx(graph, pos=layout, node_color=["red" if p in feedback_vertex_set else "cyan" for p in graph.nodes()])
nx.draw_networkx(graph, pos=layout, node_color=["red" if p in feedback_vertex_set else "grey" for p in graph.nodes()])
plt.show()
_graph = graph.copy()
_graph.remove_nodes_from(feedback_vertex_set)
nx.draw_networkx(_graph, pos=layout, node_color="cyan")
nx.draw_networkx(_graph, pos=layout, node_color="grey")
plt.show()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment