source: orange/Orange/doc/networks/makeNetworkList.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 1.2 KB checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1import os
2import os.path
3import glob
4
5import orange
6import orngNetwork
7
8atts = []
9atts.append(orange.StringVariable("Network Name"))
10atts.append(orange.StringVariable("Network File"))
11atts.append(orange.StringVariable("dir"))
12atts.append(orange.StringVariable("Item Set"))
13atts.append(orange.StringVariable("Edge Set"))
14atts.append(orange.FloatVariable("Vertices"))
15atts[-1].numberOfDecimals = 0
16atts.append(orange.FloatVariable("Edges"))
17atts[-1].numberOfDecimals = 0
18atts.append(orange.StringVariable("Date"))
19atts.append(orange.StringVariable("Description"))
20
21netlist = orange.ExampleTable(orange.Domain(atts, False))
22
23for netFile in glob.glob(os.path.join(os.getcwd(), '*.net')):
24    net = orngNetwork.Network.read(netFile)
25    name, ext = os.path.splitext(netFile)
26   
27    itemFile = ""
28    if os.path.exists(name + '_items.tab'):
29        itemFile = name + '_items.tab'
30    elif os.path.exists(name + '.tab'):
31        itemFile = name + '.tab'
32   
33    edgeFile = ""
34    if os.path.exists(name + '_edges.tab'):
35        edgeFile = name + '_edges.tab'
36   
37    netlist.append([net.name, os.path.basename(netFile), "doc/datasets/", os.path.basename(itemFile), os.path.basename(edgeFile), net.nVertices, len(net.getEdges()), "4/12/2010", net.description])
38   
39netlist.save("network_info.tab")   
Note: See TracBrowser for help on using the repository browser.