Revision 62798f6e gen_bird_preferences.py

View differences:

gen_bird_preferences.py
23 23
                    default="pref.conf", action="store",
24 24
                    help="Output conf file where the configuration will be written")
25 25
parser.add_argument("-g", "--graph", dest="graph", required=True, type=str, action="store")
26
parser.add_argument("-o", "--outer", dest="outer", default=False,
27
                    action="store_true", help="signal the presence of inner nodes")
28
parser.add_argument("-o", "--outer", dest="outer", default=False,
29
                    action="store_true", help="signal the presence of inner nodes")
26 30

  
27 31
args = parser.parse_args()
28 32

  
29 33
mlgraph = args.graph
30 34
out = args.writeto
35
outer = args.outer
31 36

  
32 37
graph = nx.read_graphml(mlgraph)
33 38

  
......
111 116

  
112 117
for key in pathPref:
113 118
    if pathPref[key] != '':
114
        pathPref[key] = 100 + int(pathPref[key].zfill(32), 2)
119
        if not outer:
120
            pathPref[key] = 100 + int(pathPref[key].zfill(32), 2)
121
        else:
122
            pathPref[key] = 100 + int(pathPref[key].zfill(3)[::-1], 3)
115 123
    else:
116 124
        pathPref[key] = 10
117 125

  

Also available in: Unified diff