File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 6565"""
6666import logging
6767import os
68+ import sys
6869import time
6970from collections import defaultdict , namedtuple
7071from io import StringIO
7980
8081log = logging .getLogger (__name__ )
8182
83+
84+ if sys .version_info < (3 , 6 ):
85+ from collections import OrderedDict
86+ from .digraph import DiGraph
87+
88+ class OrderedDiGraph (DiGraph ):
89+ """
90+ Consistently ordered variant of :class:`~networkx.DiGraph`.
91+
92+ PY3.6 has inmsertion-order dicts, but PY3.5 has not.
93+ And behvavior *and TCs) in these environments may fail spuriously!
94+ Still *subgraphs* may not patch!
95+
96+ Fix from:
97+ https://networkx.github.io/documentation/latest/_modules/networkx/classes/ordered.html
98+ """
99+ node_dict_factory = OrderedDict
100+ adjlist_outer_dict_factory = OrderedDict
101+ adjlist_inner_dict_factory = OrderedDict
102+ edge_attr_dict_factory = OrderedDict
103+
104+ # monkeypatch
105+ nx .DiGraph = OrderedDiGraph
106+
107+
82108class DataPlaceholderNode (str ):
83109 """
84110 Dag node naming a data-value produced or required by an operation.
You can’t perform that action at this time.
0 commit comments