MCPcopy Create free account
hub / github.com/PythonOT/POT / graph_colors

Function graph_colors

examples/gromov/plot_partial_fgw.py:79–89  ·  view source on GitHub ↗
(nx_graph, vmin=0, vmax=7)

Source from the content-addressed store, hash-verified

77
78
79def graph_colors(nx_graph, vmin=0, vmax=7):
80 cnorm = mcol.Normalize(vmin=vmin, vmax=vmax)
81 cpick = cm.ScalarMappable(norm=cnorm, cmap="viridis")
82 cpick.set_array([])
83 val_map = {}
84 for k, v in nx.get_node_attributes(nx_graph, "weight").items():
85 val_map[k] = cpick.to_rgba(v)
86 colors = []
87 for node in nx_graph.nodes():
88 colors.append(val_map[node])
89 return colors
90
91
92def draw_graph(

Callers 2

draw_transp_coloredFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected