Splitting edges#

shift.split_network_edges(graph: Graph, split_length: Distance) Graph#

Creates a new graph with edges sliced by given distance in meter.

Parameters:
  • graph (nx.Graph) – Networkx graph instance

  • split_length (Distance) – Maximum length of edge used for splitting.

Returns:

Splitted graph.

Return type:

nx.Graph

Examples

>>> import networkx as nx
>>> graph = nx.Graph()
>>> graph.add_node("node_1", x=-97.33, y=45.56)
>>> graph.add_node("node_2", x=-97.32, y=45.58)
>>> graph.add_edge("node_1", "node_2")
>>> split_network_edges(graph, split_length=Distance(50, "m"))