Holomap for network graph does not switch properly between cases


I am trying to make a Holomap which should represent an interactive network graph that displays its edge weight either via the line width or the line color with the additional option to change the node size of the graph.

Unfortunately, the saved Holomap has issues with switching between the cases. If the node size is set to ‘medium’ then switching between the visualization method has no effect. However, if the node size is set to ‘small’, there is no such problem.

Below you can see a simplified executable version of the program I am using. The general idea for creating the Holomap is this: I have an original graph in a network x format, which I want to make into an interactive graph. To that end, I convert it into a Holoviews graph and define a function that adjust the edge width, edge color and node size. Using that function I create a dictionary with all the resulting graphs. Lastly, I convert the dictionary into a Holomap and save it into an html file.

As I‘ve inspected the 4 different cases individually with hmap.get(), I don‘t see what the issue might be.

I am new here, so if I’ve left anything out or you have any question, feel free to ask.
Any help would be greatly appreciated.

Here is the code:

import networkx as nx
import holoviews as hv
import matplotlib.pyplot as plt

# Returns graph with edge attribute and assigned node positions
def netx_graph():
    G = nx.Graph()
    G.add_edge(1, 2, weight=4)
    G.nodes[1]["position"] = [0, 0]
    G.nodes[2]["position"] = [0, 1]
    return G

# adjusts attributes of the given hv graph
def adjust_hv_graph(H, visualisation_method, node_size):
    H_c = H.opts(inspection_policy='edges', clone = True)
    if visualisation_method == "edge color":
        H_c.opts(edge_color=hv.dim("weight"), edge_cmap= plt.cm.Blues)
    if visualisation_method == "edge width":
    if node_size == "small":
    if node_size == "medium":
    return H_c

def main():
    G = netx_graph()
    H = hv.Graph.from_networkx(G, positions=nx.get_node_attributes(G, "position"))
    f = lambda visualisation_method, node_size: adjust_hv_graph(H=H,
    # fill dictionary with all possible resulting graphs
    graphs_dict = {(visualisation_method, node_size): f(visualisation_method=visualisation_method, node_size=node_size)
                                                        for visualisation_method in ["edge width", "edge color"]
                                                        for node_size in ["small", "medium"]}
    # create a holomap from the graphs saved in the dictionary
    hmap = hv.HoloMap(graphs_dict, kdims=["visualisation_method", "node_size"])
    hv.save(obj=hmap, filename="graph.html")