Examples

Casting results into a named tuple:

from wayfarer import Edge
edges = net.edges(nbunch=upstream_nodes_ids, data=True)
edges = [Edge(*e) for e in edges]

edge = edges[0]

# get key
edge_id = edge[2]["EDGE_ID"]

edge_id = edge.key

Now we can take advantage of using properties rather than indexes and strings.

:-( above doesn’t work as Edge expects a key..

Edge(start_node=105545731, end_node=104677819, key={'EDGE_ID': 103472683, 'LEN_': 1

Would have to do..

edges = [Edge(e[0], e[1], attributes=e[2]) for e in edges]
edge_ids = [e.attributes["EDGE_ID"] for e in edges]

As keys aren’t returned by https://networkx.org/documentation/stable/reference/classes/generated/networkx.Graph.edges.html