Note
Go to the end to download the full example code.
Simple path#
A minimal example of using iplotx together with networkx.
import networkx as nx
import iplotx as ipx
G = nx.path_graph(8)
pos = nx.spring_layout(G, seed=47) # Seed layout for reproducibility
ipx.network(G, layout=pos)

[<iplotx.network.NetworkArtist object at 0x7af3e8e2a5d0>]
We can change the color of the vertices and edges with a touch of style:
ipx.network(
G,
layout=pos,
style={
"vertex": {
"facecolor": "lightblue",
"edgecolor": "navy",
"linewidth": 2.5,
},
"edge": {
"color": "navy",
"linewidth": 2.5,
},
},
)

[<iplotx.network.NetworkArtist object at 0x7af3e8d86710>]
Total running time of the script: (0 minutes 0.070 seconds)