brendapraggastis / HyperNetX

Python package for hypergraph analysis and visualization.
https://pnnl.github.io/HyperNetX/
Other
2 stars 0 forks source link

About the images in the paper #1

Open liushilei1314 opened 6 months ago

liushilei1314 commented 6 months ago

11 Hello, I saw in your paper about this image, which has semi transparent arrows and nodes inside the ring. For example, I marked it with a red line (subject blue dot object). Did you draw it using a program or manually?

bpraggastis commented 5 months ago

Hi @liushilei1314, the image in the paper was created manually. We liked it so much we added it to our new release 2.3. The new draw function allows you to add a graph to the hypergraph figure. Here is some code with plt = matplotlib.pyplot, and networkx's DiGraph:

`scenes = { 0: ('FN', 'TH'), 1: ('TH', 'JV'), 2: ('BM', 'FN', 'JA'), 3: ('JV', 'JU', 'CH', 'BM'), 4: ('JU', 'CH', 'BR', 'CN', 'CC', 'JV', 'BM'), 5: ('TH', 'GP'), 6: ('GP', 'MP'), 7: ('MA', 'GP') }

H = hnx.Hypergraph(scenes)

colors = defaultdict(lambda: plt.cm.tab10(len(colors)%10))

def get_node_color(v): return colors[v]

def get_cell_color(e): return get_node_color(e[1])

hnx.draw( H, with_additional_edges=nx.DiGraph(H.incidences.items), edges_kwargs={'edgecolors': 'black'}, nodes_kwargs={'color': get_node_color}, additional_edges_kwargs={'edge_color': get_cell_color}, edge_labels_on_edge=False, edge_label_alpha=1 )` hyp_example

You can find it in the new version under tutorials/basic/Basic 2...