Python: How I can split edges with n nodes
Question: Is it possible to add additional nodes to the network by splitting existing
edges with given number of nodes?

Say, I generate a random graph, then I want to "cut" all existing edges into n
equal segments with nodes at the ends.

Thanks


Answer: Yes use
[`remove_edges_from`](http://networkx.lanl.gov/reference/generated/networkx.MultiGraph.remove_edges_from.html):

    
    
    In [49]:
    
    import networkx as nx
    g = nx.krackhardt_kite_graph()
    g.edges()
    Out[49]:
    [(0, 1),
     (0, 2),
     (0, 3),
     (0, 5),
     (1, 3),
     (1, 4),
     (1, 6),
     (2, 3),
     (2, 5),
     (3, 4),
     (3, 5),
     (3, 6),
     (4, 6),
     (5, 6),
     (5, 7),
     (6, 7),
     (7, 8),
     (8, 9)]
    

Now remove edges:

    
    
    g.remove_edges_from(g.edges())
    g.edges()
    
    Out[51]:
    []
    In [52]:
    
    g.nodes()
    Out[52]:
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    

You can now arbritratily add new nodes and edges

