Вам необходимо указать атрибуты ребер как несколько аргументов ключевых слов (обычно представленных в сигнатурах функций как **kwargs
):
import networkx as nx
g = nx.DiGraph()
g.add_edge(1,2, DIRECTIONA="oneway")
g.add_edge(1,3, DIRECTIONA="oneway")
g.add_edge(1,4, DIRECTIONA="bothDirections")
g.add_edge(2,3, DIRECTIONA="bothDirections")
g.add_edge(2,4, DIRECTIONA="oneway")
print(g.edges(data=True))
# [(1, 2, {'DIRECTIONA': 'oneway'}), (1, 3, {'DIRECTIONA': 'oneway'}), (1, 4, {'DIRECTIONA': 'bothDirections'}), (2, 3, {'DIRECTIONA': 'bothDirections'}), (2, 4, {'DIRECTIONA': 'oneway'})]
custom_reversed = nx.DiGraph()
for node_from, node_to, edge_data in list(g.edges(data=True)): # networkx 2.4 doesn not have key parameter
if edge_data['DIRECTIONA'] == 'bothDirections':
custom_reversed.add_edge(node_from, node_to, **edge_data)
print(custom_reversed.edges(data=True))
[(4, 1, {'DIRECTIONA': 'bothDirections'}), (3, 2, {'DIRECTIONA': 'bothDirections'})]