NetworkX

Previous topic

networkx.draw_networkx_nodes

Next topic

networkx.draw_networkx_labels

networkx.draw_networkx_edges

draw_networkx_edges(G, pos, edgelist=None, width=1.0, edge_color='k', style='solid', alpha=None, edge_cmap=None, edge_vmin=None, edge_vmax=None, ax=None, arrows=True, **kwds)

Draw the edges of the graph G

This draws only the edges of the graph G.

Parameters:

G : graph

A networkx graph

pos : dictionary

A dictionary with nodes as keys and positions as values. If not specified a spring layout positioning will be computed. See networkx.layout for functions that compute node positions.

ax : Matplotlib Axes object, optional

Draw the graph in the specified Matplotlib axes.

alpha: float :

The edge transparency (default=1.0)

width`: float :

Line width of edges (default =1.0)

edge_color: color string, or array of floats :

Edge color. Can be a single color format string (default=’r’), or a sequence of colors with the same length as edgelist. If numeric values are specified they will be mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.

edge_ cmap: Matplotlib colormap :

Colormap for mapping intensities of edges (default=None)

edge_vmin,edge_vmax: floats :

Minimum and maximum for edge colormap scaling (default=None)

style: string :

Edge line style (default=’solid’) (solid|dashed|dotted,dashdot)

Notes

For directed graphs, “arrows” (actually just thicker stubs) are drawn at the head end. Arrows can be turned off with keyword arrows=False. Yes, it is ugly but drawing proper arrows with Matplotlib this way is tricky.

Examples

>>> G=nx.dodecahedral_graph()
>>> edges=nx.draw_networkx_edges(G,pos=nx.spring_layout(G)) 

Also see the NetworkX drawing examples at http://networkx.lanl.gov/gallery.html