Revision 62798f6e chain_gadget.py

View differences:

chain_gadget.py
72 72
        }
73 73
        nx.set_edge_attributes(g, attrs)
74 74
    if weight:
75
        for i in range(2, total_nodes, 2):
75
        for i in range(0, total_nodes, 2):
76 76
            attrs = {
77 77
                (i+id_delta, 0+id_delta): {
78
                    ATTR_EDGE_WEIGHT: i//2-1
78
                    ATTR_EDGE_WEIGHT: i//2
79
                },
80
                (i + id_delta, i + 1 + id_delta): {
81
                    ATTR_EDGE_WEIGHT: 0
82
                },
83
                (i + id_delta, i + 2 + id_delta): {
84
                    ATTR_EDGE_WEIGHT: 1
79 85
                }
80 86
            }
81 87
            nx.set_edge_attributes(g, attrs)

Also available in: Unified diff