beyondbeneath / bezier-curved-edges-networkx

Function to produce Bezier curves for the edges in a NetworkX graph
MIT License
61 stars 12 forks source link

where you get curved_edges #3

Closed rawenlei closed 5 years ago

rawenlei commented 5 years ago

hi: it is so beautiful graph via networkx. Would you mind telling me where the "curved_edges" is from?

thank you very much!

best regards, rawen rawen0623@live.com

` -- #1 Imports import networkx as nx import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from fa2 import ForceAtlas2

--# 1 Load the graph edges and compute the node positions using ForceAtlas2 G = nx.read_edgelist('facebook_combined.txt') forceatlas2 = ForceAtlas2() positions = forceatlas2.forceatlas2_networkx_layout(G, pos=None, iterations=50)

-- #1 Produce the curves curves = curved_edges(G, positions) lc = LineCollection(curves, color='w', alpha=0.05)

-- #1 Plot plt.figure(figsize=(20,20)) nx.draw_networkx_nodes(G, positions, node_size=5, node_color='w', alpha=0.4) plt.gca().add_collection(lc) plt.tick_params(axis='both',which='both',bottom=False,left=False,labelbottom=False,labelleft=False) plt.show() `

beyondbeneath commented 5 years ago

Thank @rawenlei and sorry for the delayed reply.

The curved_edges function is contained in curved_edges.py, which is the main script provided by this repo. Sorry that wasn't clear from the README examples!

Let me know if you have any further questions.

beyondbeneath commented 5 years ago

I've updated the README to show the explicit way to get this function, i.e.:

from curved_edges import curved_edges

Closing this issue.