├── .gitignore
├── README.md
├── on-classifying-complex-networks-by-their-features.pdf
├── scripts_features
├── RUN_10.sh
├── RUN_9.sh
├── run_atlas.sh
├── run_auto.sh
├── run_carbon.sh
├── run_cellular.sh
├── run_citation.sh
├── run_colla.sh
├── run_communication.sh
├── run_ground.sh
├── run_location.sh
├── run_metabolic.sh
├── run_p2p.sh
├── run_products.sh
├── run_road.sh
├── run_signed.sh
├── run_social_I.sh
├── run_social_II.sh
├── run_webgraphs.sh
├── run_wiki.sh
└── run_yeast.sh
├── scripts_features_adv
├── RUN_10.sh
├── RUN_9.sh
├── run_atlas.sh
├── run_auto.sh
├── run_carbon.sh
├── run_cellular.sh
├── run_citation.sh
├── run_colla.sh
├── run_communication.sh
├── run_ground.sh
├── run_location.sh
├── run_metabolic.sh
├── run_p2p.sh
├── run_products.sh
├── run_road.sh
├── run_signed.sh
├── run_social_I.sh
├── run_social_II.sh
├── run_webgraphs.sh
├── run_wiki.sh
└── run_yeast.sh
├── scripts_sampling
├── RUN_10.sh
├── RUN_9.sh
├── run_atlas.sh
├── run_auto.sh
├── run_carbon.sh
├── run_cellular.sh
├── run_citation.sh
├── run_colla.sh
├── run_communication.sh
├── run_ground.sh
├── run_location.sh
├── run_metabolic.sh
├── run_p2p.sh
├── run_products.sh
├── run_road.sh
├── run_social_I.sh
├── run_social_II.sh
├── run_webgraphs.sh
├── run_wiki.sh
└── run_yeast.sh
├── scripts_to_extract_data
├── 1-getdata_social.sh
├── 10-getadata_auto.sh
├── 11-getdata_signed.sh
├── 12-getdata_location.sh
├── 13-getdata_wiki.sh
├── 14-getdata_meme.sh
├── 15-getdata_onlinecom.sh
├── 16-getdata_foodweb.sh
├── 17-getdata_yeast.sh
├── 18-getdata_cellular.sh
├── 19-getdata_protein.sh
├── 2-getdata_ground.sh
├── 3-getdata_comm.sh
├── 4-getdata_citation.sh
├── 5-getdata_collab.sh
├── 6-getadata_webgraphs.sh
├── 7-getadata_products.sh
├── 8-getdata_p2p.sh
├── 9-getdata_road.sh
├── getdata_snap.sh
└── getdata_test.sh
└── src
├── calculate_features
├── atlas.py
├── auto.py
├── carbon.py
├── cellular.py
├── citation.py
├── collaboration.py
├── communication.py
├── ground.py
├── helpers
│ ├── __init__.py
│ ├── constants.py
│ ├── features
│ │ ├── __init__.py
│ │ ├── assortativity.py
│ │ ├── clique_number.py
│ │ ├── clustering.py
│ │ ├── coreness.py
│ │ ├── degree.py
│ │ ├── edge_connectivity.py
│ │ ├── number_of_cliques.py
│ │ ├── number_of_triangles.py
│ │ ├── order.py
│ │ ├── size.py
│ │ └── transitivity.py
│ ├── process.py
│ ├── running.py
│ └── save.py
├── location.py
├── metabolic.py
├── p2p.py
├── products.py
├── road.py
├── signed.py
├── social_I.py
├── social_II.py
├── webgraphs.py
├── wiki.py
└── yeast.py
├── calculate_features_advanced
├── atlas.py
├── auto.py
├── carbon.py
├── cellular.py
├── citation.py
├── collaboration.py
├── communication.py
├── ground.py
├── helpers
│ ├── __init__.py
│ ├── constants.py
│ ├── features
│ │ ├── __init__.py
│ │ ├── betweeness.py
│ │ ├── centrality.py
│ │ ├── communicability.py
│ │ ├── density.py
│ │ ├── diameter.py
│ │ ├── eccentricity.py
│ │ ├── node_connectivity.py
│ │ ├── pagerank.py
│ │ ├── radius.py
│ │ └── square_clustering.py
│ ├── process.py
│ ├── running.py
│ └── save.py
├── location.py
├── metabolic.py
├── p2p.py
├── products.py
├── road.py
├── signed.py
├── social_I.py
├── social_II.py
├── webgraphs.py
├── wiki.py
└── yeast.py
└── make_normalization
├── atlas.py
├── auto.py
├── carbon.py
├── cellular.py
├── citation.py
├── collaboration.py
├── communication.py
├── ground.py
├── helpers
├── __init__.py
├── constants.py
├── mhrw.py
└── running.py
├── location.py
├── metabolic.py
├── p2p.py
├── products.py
├── road.py
├── signed.py
├── social_I.py
├── social_II.py
├── webgraphs.py
├── wiki.py
└── yeast.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *~
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | bin/
13 | build/
14 | develop-eggs/
15 | dist/
16 | eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | *.egg-info/
23 | .installed.cfg
24 | *.egg
25 |
26 | # Installer logs
27 | pip-log.txt
28 | pip-delete-this-directory.txt
29 |
30 | # Unit test / coverage reports
31 | htmlcov/
32 | .tox/
33 | .coverage
34 | .cache
35 | nosetests.xml
36 | coverage.xml
37 |
38 | # Translations
39 | *.mo
40 |
41 | # Mr Developer
42 | .mr.developer.cfg
43 | .project
44 | .pydevproject
45 |
46 | # Rope
47 | .ropeproject
48 |
49 | # Django stuff:
50 | *.log
51 | *.pot
52 |
53 | # Sphinx documentation
54 | docs/_build/
55 |
56 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## ml-graph-network-analyser
2 |
3 |
4 |
5 | #### 👉 this project contains the source code for the extraction and analysis of several graph (complex networks) features from publicly available datasets with [NetworkX](https://networkx.org/)
6 | #### 👉 [read the final research paper here](on-classifying-complex-networks-by-their-features.pdf)
7 |
8 |
9 |
10 |
11 | ---
12 |
13 | ### analyzed features
14 |
15 |
16 |
17 | * assortativity
18 | * clique number
19 | * clustering
20 | * density
21 | * diameter
22 | * edge connectivity
23 | * node connectivity
24 | * number of cliques
25 | * number of edges
26 | * number of nodes
27 | * radius
28 | * clustering and transitivity
29 | * betweenness centrality
30 | * closeness centrality
31 | * communicability centrality
32 | * coreness
33 | * degree centrality
34 | * eccentricity
35 | * number of triangles
36 | * pagerank
37 | * square clustering
38 | * transitivity
39 |
40 |
41 |
42 | ---
43 |
44 | ### analyzed networks
45 |
46 |
47 |
48 | * **social networks**: online social networks, edges represent interactions between people
49 | * **ground truth**: ground-truth network communities in social and information networks
50 | * **communication**: email communication networks with edges representing communication
51 | * **citation**: nodes represent papers, edges represent citations
52 | * **collaboration**: nodes represent scientists, edges represent collaborations (co-authoring a paper)
53 | * **web graphs**: nodes represent webpages and edges are hyperlinks
54 | * **products**: nodes represent products and edges link commonly co-purchased products
55 | * **p2p**: nodes represent computers and edges represent communication
56 | * **roads**: nodes represent intersections and edges roads connecting the intersections
57 | * **autonomous systems**: graphs of the internet
58 | * **signed networks**: networks with positive and negative edges (friend/foe, trust/distrust)
59 | * **location-based networks**: Social networks with geographic check-ins
60 | * **wikipedia**: yalk, editing and voting data from Wikipedia
61 | * **bio atlas**: food-webs selected from the ecosystem network analysis resources
62 | * **bio-cellular**: substrate in the cellular network of the corresponding organism
63 | * **bio-metabolic**: metabolic network of the corresponding organisms
64 | * **bio-carbon**: carbon exchanges in the cypress wetlands of south florida during the wet and dry season
65 | * **bio yeast**: protein-protein interaction network in budding yeast
66 |
67 |
68 |
69 |
70 | ---
71 |
72 | ### additional considerations
73 |
74 |
75 |
76 | #### normalization and graph sampling
77 |
78 | * performed using snowball sampling (choosing the sample order, i.e., number of nodes)
79 | * optimized for the number of edges and multiple samplings
80 |
81 |
82 |
83 | #### next steps in the data pipeline
84 |
85 |
86 | * **[1. cleanse the data, with ml-netclean](https://github.com/autistic-symposium/ml-netclean)**
87 | * **[2. classify the networks with several machine learning techniques, with mlnet](https://github.com/autistic-symposium/mlnet-complex-networks)**
88 |
89 |
--------------------------------------------------------------------------------
/on-classifying-complex-networks-by-their-features.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/autistic-symposium/ml-graph-network-analyser-py/6d673e7dcf9058a5a41fa23d1d4e862a8ab45276/on-classifying-complex-networks-by-their-features.pdf
--------------------------------------------------------------------------------
/scripts_features/RUN_10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./run_atlas.sh > oatlas &
4 | ./run_auto.sh > oauto &
5 | ./run_carbon.sh > ocarb &
6 | ./run_cellular.sh > ocell &
7 | ./run_citation.sh > ocit &
8 | ./run_colla.sh > ocolla &
9 | ./run_communication.sh > ocomm &
10 | ./run_ground.sh > ogrou &
11 | ./run_location.sh > oloca &
12 | ./run_metabolic.sh > omet &
13 |
--------------------------------------------------------------------------------
/scripts_features/RUN_9.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | ./run_p2p.sh > op2p &
5 | ./run_products.sh > opro &
6 | ./run_road.sh > oroad &
7 | ./run_signed.sh > orsig14 &
8 | ./run_social_II.sh > osocial2 &
9 | ./run_social_I.sh > osocial1 &
10 | ./run_webgraphs.sh > oweb &
11 | ./run_wiki.sh > owiki &
12 | ./run_yeast.sh > oyeast &
13 |
--------------------------------------------------------------------------------
/scripts_features/run_atlas.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python atlas.py
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_auto.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 |
6 | cd ../src/calculate_features/
7 | python auto.py
8 |
9 | cd ../..
10 |
11 |
--------------------------------------------------------------------------------
/scripts_features/run_carbon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python carbon.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_cellular.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python cellular.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_citation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python citation.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_colla.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python collaboration.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_communication.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python communication.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_ground.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python ground.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_location.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python location.py
6 | cd ../..
7 |
--------------------------------------------------------------------------------
/scripts_features/run_metabolic.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python metabolic.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_p2p.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python p2p.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_products.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python products.py
6 | cd ../..
7 |
--------------------------------------------------------------------------------
/scripts_features/run_road.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features/
4 | python road.py
5 |
6 | cd ../..
7 |
--------------------------------------------------------------------------------
/scripts_features/run_signed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python signed.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_social_I.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python social_I.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_features/run_social_II.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/calculate_features/
6 | python social_II.py
7 |
8 | cd ../..
9 |
10 |
--------------------------------------------------------------------------------
/scripts_features/run_webgraphs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python webgraphs.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_wiki.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python wiki.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features/run_yeast.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/calculate_features/
5 | python yeast.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_features_adv/RUN_10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./run_atlas.sh > oatlas &
4 | ./run_auto.sh > oauto &
5 | ./run_carbon.sh > ocarb &
6 | ./run_cellular.sh > ocell &
7 | ./run_citation.sh > ocit &
8 | ./run_colla.sh > ocolla &
9 | ./run_communication.sh > ocomm &
10 | ./run_ground.sh > ogrou &
11 | ./run_location.sh > oloca &
12 | ./run_metabolic.sh > omet &
13 |
--------------------------------------------------------------------------------
/scripts_features_adv/RUN_9.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | ./run_p2p.sh > op2p &
5 | ./run_products.sh > opro &
6 | ./run_road.sh > oroad &
7 | ./run_signed.sh > orsig14 &
8 | ./run_social_II.sh > osocial2 &
9 | ./run_social_I.sh > osocial1 &
10 | ./run_webgraphs.sh > oweb &
11 | ./run_wiki.sh > owiki &
12 | ./run_yeast.sh > oyeast &
13 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_atlas.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python atlas.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_auto.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python auto.py
5 | cd ../..
6 |
7 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_carbon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python carbon.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_cellular.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python cellular.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_citation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python citation.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_colla.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python collaboration.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_communication.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python communication.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_ground.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python ground.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_location.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python location.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_metabolic.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python metabolic.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_p2p.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python p2p.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_products.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python products.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_road.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd ../src/calculate_features_advanced/
3 | python road.py
4 | cd ../..
5 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_signed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python signed.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_social_I.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python social_I.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_social_II.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python social_II.py
5 | cd ../..
6 |
7 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_webgraphs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python webgraphs.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_wiki.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python wiki.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_features_adv/run_yeast.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/calculate_features_advanced/
4 | python yeast.py
5 | cd ../..
6 |
--------------------------------------------------------------------------------
/scripts_sampling/RUN_10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./run_atlas.sh > oatlas &
4 | ./run_auto.sh > oauto &
5 | ./run_carbon.sh > ocarb &
6 | ./run_cellular.sh > ocell &
7 | ./run_citation.sh > ocit &
8 | ./run_colla.sh > ocolla &
9 | ./run_communication.sh > ocomm &
10 | ./run_ground.sh > ogrou &
11 | ./run_location.sh > oloca &
12 | ./run_metabolic.sh > omet &
13 |
--------------------------------------------------------------------------------
/scripts_sampling/RUN_9.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | ./run_p2p.sh > op2p &
5 | ./run_products.sh > opro &
6 | ./run_road.sh > oroad &
7 | ./run_signed.sh > orsig14 &
8 | ./run_social_II.sh > osocial2 &
9 | ./run_social_I.sh > osocial1 &
10 | ./run_webgraphs.sh > oweb &
11 | ./run_wiki.sh > owiki &
12 | ./run_yeast.sh > oyeast &
13 |
--------------------------------------------------------------------------------
/scripts_sampling/run_atlas.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/make_normalization/
5 | python atlas.py
6 | cd ../..
7 |
--------------------------------------------------------------------------------
/scripts_sampling/run_auto.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 |
6 | cd ../src/make_normalization/
7 | python auto.py
8 |
9 | cd ../..
10 |
11 |
--------------------------------------------------------------------------------
/scripts_sampling/run_carbon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/make_normalization/
4 | python carbon.py
5 |
6 | cd ../..
7 |
--------------------------------------------------------------------------------
/scripts_sampling/run_cellular.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python cellular.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_citation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python citation.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_colla.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python collaboration.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_communication.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python communication.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_ground.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python ground.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_location.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/make_normalization/
5 | python location.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_sampling/run_metabolic.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python metabolic.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_p2p.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python p2p.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_products.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/make_normalization/
5 | python products.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_sampling/run_road.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python road.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_social_I.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | cd ../src/make_normalization/
5 | python social_I.py
6 |
7 | cd ../..
8 |
--------------------------------------------------------------------------------
/scripts_sampling/run_social_II.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd ../src/make_normalization/
4 | python social_II.py
5 |
6 | cd ../..
7 |
8 |
--------------------------------------------------------------------------------
/scripts_sampling/run_webgraphs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python webgraphs.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_wiki.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python wiki.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_sampling/run_yeast.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 |
5 | cd ../src/make_normalization/
6 | python yeast.py
7 |
8 | cd ../..
9 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/1-getdata_social.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | wget http://snap.stanford.edu/data/twitter.tar.gz && tar xzvf twitter.tar.gz && rm twitter.tar.gz && mv twitter raw_data/social/
4 | echo "Twiter!"
5 |
6 | wget http://snap.stanford.edu/data/facebook.tar.gz && tar xzvf facebook.tar.gz && rm facebook.tar.gz && mv facebook raw_data/social/
7 | echo "Facebook!"
8 |
9 | wget http://snap.stanford.edu/data/gplus.tar.gz && tar xzvf gplus.tar.gz && rm gplus.tar.gz && mv gplus raw_data/social/
10 | echo "gplus!"
11 |
12 | mkdir ./raw_data/social/epinions/
13 | wget http://snap.stanford.edu/data/soc-Epinions1.txt.gz && gzip -d soc-Epinions1.txt.gz && mv soc-Epinions1.txt raw_data/social/epinions/
14 | echo "epinions!"
15 |
16 | mkdir ./raw_data/social/livejournal/
17 | wget http://snap.stanford.edu/data/soc-LiveJournal1.txt.gz && gzip -d soc-LiveJournal1.txt.gz && mv soc-LiveJournal1.txt raw_data/social/livejournal/
18 | epinions
19 |
20 | mkdir ./raw_data/social/pokec/
21 | wget http://snap.stanford.edu/data/soc-pokec-relationships.txt.gz && gzip -d soc-pokec-relationships.txt.gz && mv soc-pokec-relationships.txt raw_data/echo "pokec!"
22 |
23 | mkdir ./raw_data/social/slashdot08/
24 | wget http://snap.stanford.edu/data/soc-Slashdot0811.txt.gz && gzip -d soc-Slashdot0811.txt.gz && mv soc-Slashdot0811.txt raw_data/social/slashdot08/
25 | echo "slashdot1!"
26 |
27 | mkdir ./raw_data/social/slashdot09/
28 | wget http://snap.stanford.edu/data/soc-Slashdot0902.txt.gz && gzip -d soc-Slashdot0902.txt.gz && mv soc-Slashdot0902.txt raw_data/social/slashdot09/
29 | echo "slashdot2!"
30 |
31 | mkdir ./raw_data/social/wiki/
32 | wget http://snap.stanford.edu/data/wiki-Vote.txt.gz && gzip -d wiki-Vote.txt.gz && mv wiki-Vote.txt raw_data/social/wiki/
33 | echo "wiki!"
34 |
35 |
36 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/10-getadata_auto.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/auto/as1/
4 | wget http://snap.stanford.edu/data/as20000102.txt.gz && gzip -d as20000102.txt.gz && mv as20000102.txt raw_data/auto/as1/
5 | echo "as1!"
6 |
7 | mkdir ./raw_data/auto/as2/
8 | wget http://snap.stanford.edu/data/as-skitter.txt.gz && gzip -d as-skitter.txt.gz && mv as-skitter.txt raw_data/auto/as2/
9 | echo "as2!"
10 |
11 | mkdir ./raw_data/auto/as3/
12 | wget http://snap.stanford.edu/data/as-caida.tar.gz && tar xzvf as-caida.tar.gz && rm as-caida.tar.gz && mv as-caida* raw_data/auto/as3/
13 | echo "as3!"
14 |
15 | mkdir ./raw_data/auto/ore1/
16 | wget http://snap.stanford.edu/data/oregon1_010331.txt.gz && gzip -d oregon1_010331.txt.gz && mv oregon1_010331.txt raw_data/auto/ore1/
17 | echo "ore1-1!"
18 |
19 | wget http://snap.stanford.edu/data/oregon1_010407.txt.gz && gzip -d oregon1_010407.txt.gz && mv oregon1_010407.txt raw_data/auto/ore1/
20 | echo "ore1-2!"
21 |
22 | wget http://snap.stanford.edu/data/oregon1_010414.txt.gz && gzip -d oregon1_010414.txt.gz && mv oregon1_010414.txt raw_data/auto/ore1/
23 | echo "ore1-3!"
24 |
25 | wget http://snap.stanford.edu/data/oregon1_010421.txt.gz && gzip -d oregon1_010421.txt.gz && mv oregon1_010421.txt raw_data/auto/ore1/
26 | echo "ore1-4!"
27 |
28 | wget http://snap.stanford.edu/data/oregon1_010428.txt.gz && gzip -d oregon1_010428.txt.gz && mv oregon1_010428.txt raw_data/auto/ore1/
29 | echo "ore1-5!"
30 |
31 | wget http://snap.stanford.edu/data/oregon1_010505.txt.gz && gzip -d oregon1_010505.txt.gz && mv oregon1_010505.txt raw_data/auto/ore1/
32 | echo "ore1-6!"
33 |
34 | wget http://snap.stanford.edu/data/oregon1_010512.txt.gz && gzip -d oregon1_010512.txt.gz && mv oregon1_010512.txt raw_data/auto/ore1/
35 | echo "ore1-7!"
36 |
37 | wget http://snap.stanford.edu/data/oregon1_010519.txt.gz && gzip -d oregon1_010519.txt.gz && mv oregon1_010519.txt raw_data/auto/ore1/
38 | echo "ore1-8!"
39 |
40 | wget http://snap.stanford.edu/data/oregon1_010526.txt.gz && gzip -d oregon1_010526.txt.gz && mv oregon1_010526.txt raw_data/auto/ore1/
41 | echo "ore1-9!"
42 |
43 | mkdir ./raw_data/auto/ore2/
44 | wget http://snap.stanford.edu/data/oregon2_010331.txt.gz && gzip -d oregon2_010331.txt.gz && mv oregon2_010331.txt raw_data/auto/ore2/
45 | echo "ore2-1!"
46 |
47 | wget http://snap.stanford.edu/data/oregon2_010407.txt.gz && gzip -d oregon2_010407.txt.gz && mv oregon2_010407.txt raw_data/auto/ore2/
48 | echo "ore2-2!"
49 |
50 | wget http://snap.stanford.edu/data/oregon2_010414.txt.gz && gzip -d oregon2_010414.txt.gz && mv oregon2_010414.txt raw_data/auto/ore2/
51 | echo "ore2-3!"
52 |
53 | wget http://snap.stanford.edu/data/oregon2_010421.txt.gz && gzip -d oregon2_010421.txt.gz && mv oregon2_010421.txt raw_data/auto/ore2/
54 | echo "ore2-4!"
55 |
56 | wget http://snap.stanford.edu/data/oregon2_010428.txt.gz && gzip -d oregon2_010428.txt.gz && mv oregon2_010428.txt raw_data/auto/ore2/
57 | echo "ore2-5!"
58 |
59 | wget http://snap.stanford.edu/data/oregon2_010505.txt.gz && gzip -d oregon2_010505.txt.gz && mv oregon2_010505.txt raw_data/auto/ore2/
60 | echo "ore2-6!"
61 |
62 | wget http://snap.stanford.edu/data/oregon2_010512.txt.gz && gzip -d oregon2_010512.txt.gz && mv oregon2_010512.txt raw_data/auto/ore2/
63 | echo "ore2-7!"
64 |
65 | wget http://snap.stanford.edu/data/oregon2_010519.txt.gz && gzip -d oregon2_010519.txt.gz && mv oregon2_010519.txt raw_data/auto/ore2/
66 | echo "ore2-8!"
67 |
68 | wget http://snap.stanford.edu/data/oregon2_010526.txt.gz && gzip -d oregon2_010526.txt.gz && mv oregon2_010526.txt raw_data/auto/ore2/
69 | echo "ore2-9!"
70 |
71 |
72 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/11-getdata_signed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/signed/soc1/
4 | wget http://snap.stanford.edu/data/soc-sign-epinions.txt.gz && gzip -d soc-sign-epinions.txt.gz && mv soc-sign-epinions.txt raw_data/signed/soc1/
5 | echo "soc1!"
6 |
7 | mkdir ./raw_data/signed/soc2/
8 | wget http://snap.stanford.edu/data/soc-sign-Slashdot081106.txt.gz && gzip -d soc-sign-Slashdot081106.txt.gz && mv soc-sign-Slashdot081106.txt raw_data/signed/soc2/
9 | echo "soc2!"
10 |
11 | mkdir ./raw_data/signed/soc3/
12 | wget http://snap.stanford.edu/data/soc-sign-Slashdot090216.txt.gz && gzip -d soc-sign-Slashdot090216.txt.gz && mv soc-sign-Slashdot090216.txt raw_data/signed/soc3/
13 | echo "soc3!"
14 |
15 | mkdir ./raw_data/signed/soc4/
16 | wget http://snap.stanford.edu/data/soc-sign-Slashdot090221.txt.gz&& gzip -d soc-sign-Slashdot090221.txt.gz && mv soc-sign-Slashdot090221.txt raw_data/signed/soc4/
17 | echo "soc4!"
18 |
19 |
20 | mkdir ./raw_data/signed/wiki-ele/
21 | wget http://snap.stanford.edu/data/wikiElec.ElecBs3.txt.gz && gzip -d wikiElec.ElecBs3.txt.gz && mv wikiElec.ElecBs3.txt raw_data/signed/wiki-ele/
22 | echo "wiki-ele!"
23 |
24 |
25 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/12-getdata_location.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/location/gowalla/
4 | wget http://snap.stanford.edu/data/loc-gowalla_edges.txt.gz && gzip -d loc-gowalla_edges.txt.gz && mv loc-gowalla_edges.txt raw_data/location/gowalla/
5 | echo "gowalla!"
6 |
7 | mkdir ./raw_data/location/bright/
8 | wget http://snap.stanford.edu/data/loc-brightkite_edges.txt.gz && gzip -d loc-brightkite_edges.txt.gz && mv loc-brightkite_edges.txt raw_data/location/bright/
9 | echo "bright!"
10 |
11 |
12 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/13-getdata_wiki.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/wiki/vote/
4 | wget http://snap.stanford.edu/data/wiki-Vote.txt.gz && gzip -d wiki-Vote.txt.gz && mv wiki-Vote.txt raw_data/wiki/vote/
5 | echo "vote!"
6 |
7 | mkdir ./raw_data/wiki/talk/
8 | wget http://snap.stanford.edu/data/wiki-Talk.txt.gz && gzip -d wiki-Talk.txt.gz && mv wiki-Talk.txt raw_data/wiki/talk/
9 | echo "talk!"
10 |
11 | mkdir ./raw_data/wiki/elec/
12 | wget http://snap.stanford.edu/data/wikiElec.ElecBs3.txt.gz && gzip -d wikiElec.ElecBs3.txt.gz && mv wikiElec.ElecBs3.txt raw_data/wiki/elec/
13 | echo "elec!"
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/14-getdata_meme.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/meme/sn/
4 | wget http://snap.stanford.edu/data/higgs-social_network.edgelist.gz && gzip -d higgs-social_network.edgelist.gz && mv higgs-social_network.edgelist raw_data/meme/sn/
5 | echo "sn!"
6 |
7 | mkdir ./raw_data/meme/retweet/
8 | wget http://snap.stanford.edu/data/higgs-retweet_network.edgelist.gz && gzip -d higgs-retweet_network.edgelist.gz && mv higgs-retweet_network.edgelist raw_data/meme/retweet/
9 | echo "retweet!"
10 |
11 | mkdir ./raw_data/meme/reply/
12 | wget http://snap.stanford.edu/data/higgs-reply_network.edgelist.gz && gzip -d higgs-reply_network.edgelist.gz && mv higgs-reply_network.edgelist raw_data/meme/reply/
13 | echo "reply!"
14 |
15 | mkdir ./raw_data/meme/mention/
16 | wget http://snap.stanford.edu/data/higgs-mention_network.edgelist.gz && gzip -d higgs-mention_network.edgelist.gz && mv higgs-mention_network.edgelist raw_data/meme/mention/
17 | echo "mention!"
18 |
19 |
20 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/15-getdata_onlinecom.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/onlinecom/reddit/
4 | wget http://snap.stanford.edu/data/redditSubmissions.csv.gz && gzip -d redditSubmissions.csv.gz && mv redditSubmissions.csv raw_data/onlinecom/reddit/
5 | echo "reddit!"
6 |
7 | mkdir ./raw_data/onlinecom/flickr/
8 | wget http://snap.stanford.edu/data/flickrEdges.txt.gz && gzip -d flickrEdges.txt.gz && mv flickrEdges.txt raw_data/onlinecom/flickr/
9 | echo "flickr!"
10 |
11 |
12 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/16-getdata_foodweb.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/bio/foodweb/
4 | wget http://vlado.fmf.uni-lj.si/pub/networks/data/bio/FoodWeb/Webs_paj.zip && gzip -d Webs_paj.zip && mv Webs_paj.* raw_data/bio/foodweb/
5 | wget http://vlado.fmf.uni-lj.si/pub/networks/data/bio/FoodWeb/ATLSS_paj.zip && gzip -d ATLSS_paj.zip && mv ATLSS_paj.* raw_data/bio/foodweb/
6 | echo "FoodWeb!"
7 |
8 |
9 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/17-getdata_yeast.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/bio/yeast/
4 | wget http://vlado.fmf.uni-lj.si/pub/networks/data/bio/Yeast/yeast.zip && gzip -d yeast.zip && mv yeast.zip.* raw_data/bio/yeast/
5 | echo "yeast!"
6 |
7 |
8 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/18-getdata_cellular.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/bio/cellular/
4 | wget http://www3.nd.edu/~networks/resources/cellular/AA.dat.gz.zip
5 | wget http://www3.nd.edu/~networks/resources/cellular/AB.dat.gz
6 | wget http://www3.nd.edu/~networks/resources/cellular/AG.dat.gz
7 | wget http://www3.nd.edu/~networks/resources/cellular/AP.dat.gz
8 | wget http://www3.nd.edu/~networks/resources/cellular/AT.dat.gz
9 | wget http://www3.nd.edu/~networks/resources/cellular/BB.dat.gz
10 | wget http://www3.nd.edu/~networks/resources/cellular/BS.dat.gz
11 | wget http://www3.nd.edu/~networks/resources/cellular/CA.dat.gz
12 | wget http://www3.nd.edu/~networks/resources/cellular/CE.dat.gz
13 | wget http://www3.nd.edu/~networks/resources/cellular/CJ.dat.gz
14 | wget http://www3.nd.edu/~networks/resources/cellular/CQ.dat.gz
15 | wget http://www3.nd.edu/~networks/resources/cellular/CT.dat.gz
16 | wget http://www3.nd.edu/~networks/resources/cellular/CY.dat.gz
17 | wget http://www3.nd.edu/~networks/resources/cellular/DR.dat.gz
18 | wget http://www3.nd.edu/~networks/resources/cellular/EC.dat.gz
19 | wget http://www3.nd.edu/~networks/resources/cellular/EF.dat.gz
20 | wget http://www3.nd.edu/~networks/resources/cellular/EN.dat.gz
21 | wget http://www3.nd.edu/~networks/resources/cellular/HI.dat.gz
22 | wget http://www3.nd.edu/~networks/resources/cellular/HP.dat.gz
23 | wget http://www3.nd.edu/~networks/resources/cellular/MB.dat.gz
24 | wget http://www3.nd.edu/~networks/resources/cellular/MG.dat.gz
25 | wget http://www3.nd.edu/~networks/resources/cellular/MJ.dat.gz
26 | wget http://www3.nd.edu/~networks/resources/cellular/ML.dat.gz
27 | wget http://www3.nd.edu/~networks/resources/cellular/MP.dat.gz
28 | wget http://www3.nd.edu/~networks/resources/cellular/MT.dat.gz
29 | wget http://www3.nd.edu/~networks/resources/cellular/NG.dat.gz
30 | wget http://www3.nd.edu/~networks/resources/cellular/NM.dat.gz
31 | wget http://www3.nd.edu/~networks/resources/cellular/OS.dat.gz
32 | wget http://www3.nd.edu/~networks/resources/cellular/PA.dat.gz
33 | wget http://www3.nd.edu/~networks/resources/cellular/PF.dat.gz
34 | wget http://www3.nd.edu/~networks/resources/cellular/PG.dat.gz
35 | wget http://www3.nd.edu/~networks/resources/cellular/RC.dat.gz
36 | wget http://www3.nd.edu/~networks/resources/cellular/PH.dat.gz
37 | wget http://www3.nd.edu/~networks/resources/cellular/ST.dat.gz
38 | wget http://www3.nd.edu/~networks/resources/cellular/TH.dat.gz
39 | wget http://www3.nd.edu/~networks/resources/cellular/TP.dat.gz
40 | wget http://www3.nd.edu/~networks/resources/cellular/TY.dat.gz
41 | wget http://www3.nd.edu/~networks/resources/cellular/YP.dat.gz
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | echo "cellular! need to unzip"
51 |
52 |
53 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/19-getdata_protein.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/bio/protein/
4 | wget http://www3.nd.edu/~networks/resources/protein/bo.dat.gz
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | echo "protein! need to unzip"
13 |
14 |
15 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/2-getdata_ground.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/ground/livejournal_g/
4 | wget http://snap.stanford.edu/data/bigdata/communities/com-lj.ungraph.txt.gz && gzip -d com-lj.ungraph.txt.gz && mv com-lj.ungraph.txt raw_data/ground/livejournal_g/
5 | echo "livejournal_g!"
6 |
7 | mkdir ./raw_data/ground/friendster/
8 | wget http://snap.stanford.edu/data/bigdata/communities/com-friendster.ungraph.txt.gz && gzip -d com-friendster.ungraph.txt.gz && mv com-friendster.ungraph.txt raw_data/ground/friendster/
9 | echo "friendster!"
10 |
11 |
12 | mkdir ./raw_data/ground/orkut/
13 | wget http://snap.stanford.edu/data/bigdata/communities/com-orkut.ungraph.txt.gz && gzip -d com-orkut.ungraph.txt.gz && mv com-orkut.ungraph.txt raw_data/ground/orkut/
14 | echo "orkut!"
15 |
16 | mkdir ./raw_data/ground/youtube/
17 | wget http://snap.stanford.edu/data/bigdata/communities/com-youtube.ungraph.txt.gz && gzip -d com-youtube.ungraph.txt.gz && mv com-youtube.ungraph.txt raw_data/ground/youtube/
18 | echo "youtube!"
19 |
20 | mkdir ./raw_data/ground/dblp/
21 | wget http://snap.stanford.edu/data/bigdata/communities/com-dblp.ungraph.txt.gz && gzip -d com-dblp.ungraph.txt.gz && mv com-dblp.ungraph.txt raw_data/ground/dblp/
22 | echo "dblp!"
23 |
24 | mkdir ./raw_data/ground/amazon/
25 | wget http://snap.stanford.edu/data/bigdata/communities/com-amazon.ungraph.txt.gz && gzip -d com-amazon.ungraph.txt.gz && mv com-amazon.ungraph.txt raw_data/ground/amazon/
26 | echo "amazon!"
27 |
28 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/3-getdata_comm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/communication/euall/
4 | wget http://snap.stanford.edu/data/email-EuAll.txt.gz && gzip -d email-EuAll.txt.gz && mv email-EuAll.txt raw_data/communication/euall/
5 | echo "euall!"
6 |
7 | mkdir ./raw_data/communication/enron/
8 | wget http://snap.stanford.edu/data/email-Enron.txt.gz && gzip -d email-Enron.txt.gz && mv email-Enron.txt raw_data/communication/enron/
9 | echo "enron!"
10 |
11 | mkdir ./raw_data/communication/wiki-talk/
12 | wget http://snap.stanford.edu/data/wiki-Talk.txt.gz && gzip -d wiki-Talk.txt.gz && mv wiki-Talk.txt raw_data/communication/wiki-talk/
13 | echo "wiki-talk!"
14 |
15 |
16 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/4-getdata_citation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/citation/hepph/
4 | wget http://snap.stanford.edu/data/cit-HepPh.txt.gz && gzip -d cit-HepPh.txt.gz && mv cit-HepPh.txt raw_data/citation/hepph/
5 | echo "hepph!"
6 |
7 | mkdir ./raw_data/citation/hepth/
8 | wget http://snap.stanford.edu/data/cit-HepTh.txt.gz && gzip -d cit-HepTh.txt.gz && mv cit-HepTh.txt raw_data/citation/hepth/
9 | echo "hepth!"
10 |
11 | mkdir ./raw_data/citation/patents/
12 | wget http://snap.stanford.edu/data/cit-Patents.txt.gz && gzip -d cit-Patents.txt.gz && mv cit-Patents.txt raw_data/citation/patents/
13 | echo "patents!"
14 |
15 |
16 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/5-getdata_collab.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/collaboration/astroph/
4 | wget http://snap.stanford.edu/data/ca-AstroPh.txt.gz && gzip -d ca-AstroPh.txt.gz && mv ca-AstroPh.txt raw_data/collaboration/astroph/
5 | echo "astroph!"
6 |
7 | mkdir ./raw_data/collaboration/condmat/
8 | wget http://snap.stanford.edu/data/ca-CondMat.txt.gz && gzip -d ca-CondMat.txt.gz && mv ca-CondMat.txt raw_data/collaboration/condmat/
9 | echo "condmat!"
10 |
11 | mkdir ./raw_data/collaboration/grqc/
12 | wget http://snap.stanford.edu/data/ca-GrQc.txt.gz && gzip -d ca-GrQc.txt.gz && mv ca-GrQc.txt raw_data/collaboration/grqc/
13 | echo "grqc!"
14 |
15 | mkdir ./raw_data/collaboration/hepph/
16 | wget http://snap.stanford.edu/data/ca-HepPh.txt.gz && gzip -d ca-HepPh.txt.gz && mv ca-HepPh.txt raw_data/collaboration/hepph/
17 | echo "hepph!"
18 |
19 | mkdir ./raw_data/collaboration/hepth/
20 | wget http://snap.stanford.edu/data/ca-HepTh.txt.gz && gzip -d ca-HepTh.txt.gz && mv ca-HepTh.txt raw_data/collaboration/hepth/
21 | echo "hepth!"
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/6-getadata_webgraphs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/webgraphs/berkstan/
4 | wget http://snap.stanford.edu/data/web-BerkStan.txt.gz && gzip -d web-BerkStan.txt.gz && mv web-BerkStan.txt raw_data/webgraphs/berkstan/
5 | echo "berkstan!"
6 |
7 | mkdir ./raw_data/webgraphs/google/
8 | wget http://snap.stanford.edu/data/web-Google.txt.gz && gzip -d web-Google.txt.gz && mv web-Google.txt raw_data/webgraphs/google/
9 | echo "google!"
10 |
11 | mkdir ./raw_data/webgraphs/notredame/
12 | wget http://snap.stanford.edu/data/web-NotreDame.txt.gz && gzip -d web-NotreDame.txt.gz && mv web-NotreDame.txt raw_data/webgraphs/notredame/
13 | echo "notredame!"
14 |
15 | mkdir ./raw_data/webgraphs/stanford/
16 | wget http://snap.stanford.edu/data/web-Stanford.txt.gz && gzip -d web-Stanford.txt.gz && mv web-Stanford.txt raw_data/webgraphs/stanford/
17 | echo "stanford!"
18 |
19 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/7-getadata_products.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/products/amazon1/
4 | wget http://snap.stanford.edu/data/amazon0302.txt.gz && gzip -d amazon0302.txt.gz && mv amazon0302.txt raw_data/products/amazon1/
5 | echo "amazon1!"
6 |
7 | mkdir ./raw_data/products/amazon2/
8 | wget http://snap.stanford.edu/data/amazon0312.txt.gz && gzip -d amazon0312.txt.gz && mv amazon0312.txt raw_data/products/amazon2/
9 | echo "amazon2!"
10 |
11 | mkdir ./raw_data/products/amazon3/
12 | wget http://snap.stanford.edu/data/amazon0505.txt.gz && gzip -d amazon0505.txt.gz && mv amazon0505.txt raw_data/products/amazon3/
13 | echo "amazon3!"
14 |
15 | mkdir ./raw_data/products/amazon4/
16 | wget http://snap.stanford.edu/data/amazon0601.txt.gz && gzip -d amazon0601.txt.gz && mv amazon0601.txt raw_data/products/amazon4/
17 | echo "amazon4!"
18 |
19 | mkdir ./raw_data/products/amazonmeta/
20 | wget http://snap.stanford.edu/data/bigdata/amazon/amazon-meta.txt.gz && gzip -d amazon-meta.txt.gz && mv amazon-meta.txt raw_data/products/amazonmeta/
21 | echo "amazonmeta!"
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/8-getdata_p2p.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/p2p/gnutella1/
4 | wget http://snap.stanford.edu/data/p2p-Gnutella04.txt.gz && gzip -d p2p-Gnutella04.txt.gz && mv p2p-Gnutella04.txt raw_data/p2p/gnutella1/
5 | echo "gnutella1!"
6 |
7 | mkdir ./raw_data/p2p/gnutella2/
8 | wget http://snap.stanford.edu/data/p2p-Gnutella05.txt.gz && gzip -d p2p-Gnutella05.txt.gz && mv p2p-Gnutella05.txt raw_data/p2p/gnutella2/
9 | echo "gnutella2!"
10 |
11 | mkdir ./raw_data/p2p/gnutella3/
12 | wget http://snap.stanford.edu/data/p2p-Gnutella06.txt.gz && gzip -d p2p-Gnutella06.txt.gz && mv p2p-Gnutella06.txt raw_data/p2p/gnutella3/
13 | echo "gnutella3!"
14 |
15 | mkdir ./raw_data/p2p/gnutella4/
16 | wget http://snap.stanford.edu/data/p2p-Gnutella08.txt.gz && gzip -d p2p-Gnutella08.txt.gz && mv p2p-Gnutella08.txt raw_data/p2p/gnutella4/
17 | echo "gnutella4!"
18 |
19 | mkdir ./raw_data/p2p/gnutella5/
20 | wget http://snap.stanford.edu/data/p2p-Gnutella09.txt.gz && gzip -d p2p-Gnutella09.txt.gz && mv p2p-Gnutella09.txt raw_data/p2p/gnutella5/
21 | echo "gnutella5!"
22 |
23 | mkdir ./raw_data/p2p/gnutella6/
24 | wget http://snap.stanford.edu/data/p2p-Gnutella24.txt.gz && gzip -d p2p-Gnutella24.txt.gz && mv p2p-Gnutella24.txt raw_data/p2p/gnutella6/
25 | echo "gnutella6!"
26 |
27 | mkdir ./raw_data/p2p/gnutella7/
28 | wget http://snap.stanford.edu/data/p2p-Gnutella25.txt.gz && gzip -d p2p-Gnutella25.txt.gz && mv p2p-Gnutella25.txt raw_data/p2p/gnutella7/
29 | echo "gnutella7!"
30 |
31 | mkdir ./raw_data/p2p/gnutella8/
32 | wget http://snap.stanford.edu/data/p2p-Gnutella30.txt.gz&& gzip -d p2p-Gnutella30.txt.gz && mv p2p-Gnutella30.txt raw_data/p2p/gnutella8/
33 | echo "gnutella8!"
34 |
35 | mkdir ./raw_data/p2p/gnutella9/
36 | wget http://snap.stanford.edu/data/p2p-Gnutella31.txt.gz && gzip -d p2p-Gnutella31.txt.gz && mv p2p-Gnutella31.txt raw_data/p2p/gnutella9/
37 | echo "gnutella9!"
38 |
39 |
40 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/9-getdata_road.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir ./raw_data/road/ca/
4 | wget http://snap.stanford.edu/data/roadNet-CA.txt.gz && gzip -d roadNet-CA.txt.gz && mv roadNet-CA.txt raw_data/road/ca/
5 | echo "ca!"
6 |
7 | mkdir ./raw_data/road/pa/
8 | wget http://snap.stanford.edu/data/roadNet-PA.txt.gz && gzip -d roadNet-PA.txt.gz && mv roadNet-PA.txt raw_data/road/pa/
9 | echo "pa!"
10 |
11 | mkdir ./raw_data/road/tx/
12 | wget http://snap.stanford.edu/data/roadNet-TX.txt.gz && gzip -d roadNet-TX.txt.gz && mv roadNet-TX.txt raw_data/road/tx/
13 | echo "tx!"
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/getdata_snap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | wget http://snap.stanford.edu/data/facebook.tar.gz && tar xzvf facebook.tar.gz && rm facebook.tar.gz && mv facebook raw_data/
5 | wget http://snap.stanford.edu/data/gplus.tar.gz && tar xzvf gplus.tar.gz && rm gplus.tar.gz && mv gplus raw/
6 |
7 | mkdir arxiv
8 | wget http://snap.stanford.edu/data/ca-AstroPh.txt.gz && tar xzvf ca-AstroPh.txt.gz && rm ca-AstroPh.txt.gz && mv ca-AstroPh.txt raw/arxiv/
9 |
10 |
--------------------------------------------------------------------------------
/scripts_to_extract_data/getdata_test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir raw_data/
4 | wget http://snap.stanford.edu/data/twitter.tar.gz && tar xzvf twitter.tar.gz && rm twitter.tar.gz && mv twitter raw_data/
5 |
--------------------------------------------------------------------------------
/src/calculate_features/atlas.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_ATLAS
16 | TYPE_NET_DIR = "atlas/"
17 |
18 |
19 | def main():
20 |
21 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
22 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
23 |
24 |
25 |
26 |
27 | if __name__ == '__main__':
28 | main()
29 |
--------------------------------------------------------------------------------
/src/calculate_features/auto.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_AUTO + constants.NETWORK_FILES_DIR_AUTO
16 | TYPE_NET_DIR = "auto/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features/carbon.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 |
17 |
18 | # change here for type of net:
19 | NETWORK_FILES = constants.NETWORK_FILES_UN_CARBON
20 | TYPE_NET_DIR = "carbon/"
21 |
22 |
23 |
24 |
25 |
26 | def main():
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features/cellular.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_CELLULAR
16 | TYPE_NET_DIR = "cellular/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/calculate_features/citation.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_CITATION
17 | TYPE_NET_DIR = "citation/"
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features/collaboration.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net::
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_COLLABORATION
16 | TYPE_NET_DIR = "collaboration/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features/communication.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_COMMUNICATION + constants.NETWORK_FILES_UN_COMMUNICATION
17 | TYPE_NET_DIR = "communication/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/calculate_features/ground.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_GROUND
18 | TYPE_NET_DIR = "ground/"
19 |
20 |
21 | def main():
22 |
23 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
24 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
25 |
26 |
27 |
28 |
29 | if __name__ == '__main__':
30 | main()
31 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/autistic-symposium/ml-graph-network-analyser-py/6d673e7dcf9058a5a41fa23d1d4e862a8ab45276/src/calculate_features/helpers/__init__.py
--------------------------------------------------------------------------------
/src/calculate_features/helpers/constants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | # Definition of some paths
14 | PATH_2_INPUT = "../../data/"
15 | PATH_2_OUTPUT = "../../output/"
16 | PATH_2_GRAPH_SAMPLED = "graphs_sampled/"
17 | PATH_2_GRAPH_GLOBAL = "graphs_global/"
18 | PATH_2_FEATURES_SAMPLED = "vector_sampled/"
19 | PATH_2_FEATURES_GLOBAL = "vector_global/"
20 |
21 |
22 | # How many samples to be sampled, this is a deprecated
23 | # feature since we introduced checking in the mhrw
24 | NUM_SAMPLES = 1
25 |
26 | # MHRW sampling, given by order
27 | ORDER_SAMPLING = [100, 300, 500, 1000, 2000]
28 | MIN_SIZE = [50, 150, 250, 500, 1000]
29 |
30 | # Files we want for each network.
31 | # This could be automatized, but we want to be able
32 | # to select some files manually, it can be automatized in the
33 | # future if time allows it.
34 |
35 | NETWORK_FILES_UN_YEAST = ["1.dat", '2.dat', '3.dat']
36 | NETWORK_FILES_UN_ATLAS = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat']
37 | NETWORK_FILES_UN_CARBON = ['out.foodweb-baydry', 'out.foodweb-baywet']
38 | NETWORK_FILES_UN_METABOLIC = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
39 | NETWORK_FILES_UN_CELLULAR = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
40 | NETWORK_FILES_DIR_SOCIAL_II = ["out.advogato", "out.dbpedia-occupation", "out.munmun_twitter_social", "out.petster-friendships-hamster", "out.petster-hamster", "out.slashdot-zoo", "out.ucidata-gama", "out.ucidata-zachary", "out.youtube-groupmemberships", "wiki-Vote.txt", "soc-Slashdot0902.txt", "soc-Slashdot0811.txt", "soc-Epinions1.txt"]
41 | NETWORK_FILES_DIR_SOCIAL = ["twitter", "gplus", "facebook"]
42 | NETWORK_FILES_UN_AUTO = ["as20000102.txt", "oregon1_010331.txt", "oregon1_010407.txt", "oregon1_010414.txt", "oregon1_010421.txt", "oregon1_010428.txt", "oregon1_010505.txt", "oregon1_010512.txt", "oregon1_010519.txt", "oregon1_010526.txt", "oregon2_010331.txt", "oregon2_010407.txt", "oregon2_010414.txt", "oregon2_010421.txt", "oregon2_010428.txt", "oregon2_010505.txt", "oregon2_010512.txt", "oregon2_010519.txt", "oregon2_010526.txt"]
43 | NETWORK_FILES_DIR_AUTO = ["as-caida20040105.txt", "as-caida20040202.txt", "as-caida20040301.txt", "as-caida20040405.txt", "as-caida20040503.txt", "as-caida20040607.txt", "as-caida20040705.txt", "as-caida20040802.txt", "as-caida20040906.txt", "as-caida20041004.txt", "as-caida20041101.txt", "as-caida20041206.txt", "as-caida20050103.txt", "as-caida20050207.txt", "as-caida20050307.txt", "as-caida20050404.txt", "as-caida20050502.txt", "as-caida20050606.txt", "as-caida20050704.txt", "as-caida20050801.txt", "as-caida20050905.txt", "as-caida20051003.txt", "as-caida20051107.txt", "as-caida20051205.txt", "as-caida20060102.txt", "as-caida20060109.txt", "as-caida20060116.txt", "as-caida20060123.txt", "as-caida20060130.txt", "as-caida20060206.txt", "as-caida20060213.txt", "as-caida20060220.txt", "as-caida20060227.txt", "as-caida20060306.txt", "as-caida20060313.txt", "as-caida20060320.txt", "as-caida20060327.txt", "as-caida20060403.txt", "as-caida20060410.txt", "as-caida20060417.txt", "as-caida20060424.txt", "as-caida20060501.txt", "as-caida20060508.txt", "as-caida20060515.txt", "as-caida20060522.txt", "as-caida20060529.txt", "as-caida20060605.txt", "as-caida20060612.txt", "as-caida20060619.txt", "as-caida20060626.txt", "as-caida20060703.txt", "as-caida20060710.txt", "as-caida20060717.txt", "as-caida20060724.txt", "as-caida20060731.txt", "as-caida20060807.txt", "as-caida20060814.txt", "as-caida20060821.txt", "as-caida20060828.txt", "as-caida20060904.txt", "as-caida20060911.txt", "as-caida20060918.txt", "as-caida20060925.txt", "as-caida20061002.txt", "as-caida20061009.txt", "as-caida20061016.txt", "as-caida20061023.txt", "as-caida20061030.txt", "as-caida20061106.txt", "as-caida20061113.txt", "as-caida20061120.txt", "as-caida20061127.txt", "as-caida20061204.txt", "as-caida20061211.txt", "as-caida20061218.txt", "as-caida20061225.txt", "as-caida20070101.txt", "as-caida20070108.txt", "as-caida20070115.txt", "as-caida20070122.txt", "as-caida20070129.txt", "as-caida20070205.txt", "as-caida20070212.txt", "as-caida20070219.txt", "as-caida20070226.txt", "as-caida20070305.txt", "as-caida20070312.txt", "as-caida20070319.txt", "as-caida20070326.txt", "as-caida20070402.txt", "as-caida20070409.txt", "as-caida20070416.txt", "as-caida20070423.txt", "as-caida20070430.txt", "as-caida20070507.txt", "as-caida20070514.txt", "as-caida20070521.txt", "as-caida20070528.txt", "as-caida20070604.txt", "as-caida20070611.txt", "as-caida20070618.txt", "as-caida20070625.txt", "as-caida20070702.txt", "as-caida20070709.txt", "as-caida20070716.txt", "as-caida20070723.txt", "as-caida20070730.txt", "as-caida20070806.txt", "as-caida20070813.txt", "as-caida20070820.txt", "as-caida20070827.txt", "as-caida20070903.txt", "as-caida20070910.txt", "as-caida20070917.txt", "as-caida20070924.txt", "as-caida20071001.txt", "as-caida20071008.txt", "as-caida20071015.txt", "as-caida20071022.txt", "as-caida20071029.txt", "as-caida20071105.txt", "as-caida20071112.txt"]
44 | NETWORK_FILES_DIR_CITATION = ["cit-HepPh.txt", "cit-HepTh.txt"]#, "cit-Patents.txt"]
45 | NETWORK_FILES_UN_COLLABORATION = ["ca-AstroPh.txt", "ca-CondMat.txt", "ca-GrQc.txt", "ca-HepPh.txt", "ca-HepTh.txt", "out.dblp-cite", "out.dbpedia-producer", "out.github", "out.opsahl-collaboration", "out.subelj_cora"]
46 | NETWORK_FILES_UN_COMMUNICATION = ["email-Enron.txt"]
47 | NETWORK_FILES_DIR_COMMUNICATION = ["email-EuAll.txt"]
48 | NETWORK_FILES_UN_GROUND = ["com-amazon.ungraph.txt", "com-dblp.ungraph.txt", "com-youtube.ungraph.txt"]#"com-lj.ungraph.txt", "com-orkut.ungraph.txt"]
49 | NETWORK_FILES_DIR_LOCATION = ["loc-brightkite_edges.txt", "loc-gowalla_edges.txt"]
50 | NETWORK_FILES_DIR_MEME = ["higgs-mention_network.edgelist", "higgs-reply_network.edgelist", "higgs-retweet_network.edgelist" ]
51 | NETWORK_FILES_DIR_ONLINECOM = ["flickrEdges.txt" ]
52 | NETWORK_FILES_DIR_P2P = ["p2p-Gnutella04.txt", "p2p-Gnutella05.txt", "p2p-Gnutella06.txt", "p2p-Gnutella08.txt", "p2p-Gnutella09.txt", "p2p-Gnutella24.txt", "p2p-Gnutella25.txt", "p2p-Gnutella30.txt", "p2p-Gnutella31.txt" ]
53 | NETWORK_FILES_DIR_PRODUCTS = ["amazon0302.txt", "amazon0312.txt", "amazon0505.txt", "amazon0601.txt"]
54 | NETWORK_FILES_UN_ROAD = ["roadNet-CA.txt", "roadNet-PA.txt", "roadNet-TX.txt","out.opsahl-openflights", "out.opsahl-powergrid", "out.opsahl-usairport", "out.subelj_euroroad"]
55 | NETWORK_FILES_DIR_SIGNED = ["soc-sign-epinions.txt", "soc-sign-Slashdot081106.txt", "soc-sign-Slashdot090216.txt", "soc-sign-Slashdot090221.txt"]#, "wikiElec.ElecBs3.txt"]
56 | NETWORK_FILES_DIR_WEBGRAPHS = ["web-NotreDame.txt", "web-Stanford.txt"]#
57 | NETWORK_FILES_DIR_WIKI = [ "wiki-Vote.txt"]#, "wikiElec.ElecBs3.txt"]
58 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/autistic-symposium/ml-graph-network-analyser-py/6d673e7dcf9058a5a41fa23d1d4e862a8ab45276/src/calculate_features/helpers/features/__init__.py
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/assortativity.py:
--------------------------------------------------------------------------------
1 | '''
2 | Assortativity measures the similarity of connections in the graph with respect to the node degree.
3 |
4 | Associative mixing by degree can be quantified in a number of ways, one of them is to use the correlation coefficient.
5 |
6 | Graphs that have only single edges between vertices tend in the absence of other biases to show disassortative mixing by degree because the number of edges that can fall between high-degree vertex pairs is limited. Since most networks are represented as simple graphs this implies that most should be disassortative.
7 |
8 | '''
9 |
10 | import networkx as nx
11 |
12 |
13 | def calculate(network):
14 | try:
15 | n = nx.degree_assortativity_coefficient(network)
16 | except:
17 | n = 0
18 | return round(n,7)
19 |
20 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/clique_number.py:
--------------------------------------------------------------------------------
1 | '''
2 | Return the clique number (size of the largest clique) for G.
3 | '''
4 |
5 | import networkx as nx
6 |
7 |
8 | def calculate(network):
9 | try:
10 | n = nx.graph_clique_number(network)
11 | except:
12 | n = 0
13 | return n
14 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/clustering.py:
--------------------------------------------------------------------------------
1 | '''
2 | Compute the average clustering coefficient for the graph G.
3 | '''
4 |
5 | import networkx as nx
6 |
7 | def calculate(network):
8 | try:
9 | n = nx.average_clustering(network)
10 | except:
11 | n = 0
12 | return round(n, 7)
13 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/coreness.py:
--------------------------------------------------------------------------------
1 | '''
2 | Return the core number for each vertex.
3 |
4 | A k-core is a maximal subgraph that contains nodes of degree k or more.
5 |
6 | The core number of a node is the largest value k of a k-core containing that node.
7 | '''
8 |
9 | import networkx as nx
10 |
11 |
12 | def calculate(net):
13 | if net.number_of_selfloops() > 0:
14 | try:
15 | net.remove_edges_from(net.selfloop_edges())
16 | except:
17 | return 0
18 | try:
19 | c = nx.core_number(net).values()
20 | except:
21 | return 0
22 |
23 | if len(c) == 0:
24 | return 0
25 | else:
26 | return round(sum(c)/len(c),7)
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/degree.py:
--------------------------------------------------------------------------------
1 | '''
2 | The degree centrality of a node v is the fraction of nodes it is connected to.
3 |
4 | The degree centrality values are normalized by dividing by the maximum possible degree in a simple graph n-1 where n is the number of nodes in G.
5 |
6 | For multigraphs or graphs with self loops the maximum degree might be higher than n-1 and values of degree centrality greater than 1 are possible.
7 | '''
8 |
9 | import networkx as nx
10 |
11 |
12 | def calculate(net):
13 | try:
14 | n = nx.degree_centrality(net)
15 | except:
16 | return 0
17 |
18 | if len(n.values()) == 0:
19 | return 0
20 | else:
21 | return round(sum(n.values())/len(n.values()), 7)
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/edge_connectivity.py:
--------------------------------------------------------------------------------
1 |
2 | '''
3 | Returns the edge connectivity of the graph or digraph G.
4 |
5 | The edge connectivity is equal to the minimum number of edges that must be removed to disconnect G or render it trivial. If source and target nodes are provided, this function returns the local edge connectivity: the minimum number of edges that must be removed to break all paths from source to target in G.
6 |
7 | '''
8 |
9 | import networkx as nx
10 |
11 |
12 | def calculate(network):
13 | try:
14 | n = nx.edge_connectivity(network)
15 | except:
16 | n = 0
17 | return n
18 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/number_of_cliques.py:
--------------------------------------------------------------------------------
1 | '''
2 | Returns the number of maximal cliques in G.
3 | '''
4 |
5 | import networkx as nx
6 |
7 |
8 | def calculate(network):
9 | try:
10 | n = nx.graph_number_of_cliques(network)
11 | except:
12 | n = 0
13 | return n
14 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/number_of_triangles.py:
--------------------------------------------------------------------------------
1 | '''
2 |
3 | Finds the number of triangles that include a node as one vertex.
4 | '''
5 |
6 | import networkx as nx
7 |
8 |
9 | def calculate(network):
10 | try:
11 | n = nx.triangles(network)
12 | except:
13 | return 0
14 |
15 | if len(n) == 0:
16 | return 0
17 | else:
18 | return round(sum(n.values())/len(n.values()), 7)
19 |
20 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/order.py:
--------------------------------------------------------------------------------
1 | '''
2 | Total number of nodes in the graph (graph order):
3 | n = |V|
4 | '''
5 | import networkx as nx
6 |
7 |
8 | def calculate(network):
9 | try:
10 | n = network.order()
11 | except:
12 | n = 0
13 | return n
14 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/size.py:
--------------------------------------------------------------------------------
1 | '''
2 | Total number of edges n the graph (graph size):
3 | m = |E|
4 | '''
5 | import networkx as nx
6 |
7 |
8 | def calculate(network):
9 | try:
10 | n = network.size()
11 | except:
12 | n = 0
13 | return n
14 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/features/transitivity.py:
--------------------------------------------------------------------------------
1 | '''
2 | Compute graph transitivity, the fraction of all possible triangles present in G.
3 |
4 | '''
5 |
6 | import networkx as nx
7 |
8 |
9 | def calculate(network):
10 | try:
11 | n = nx.transitivity(network)
12 | except:
13 | n = 0
14 | return round(n, 5)
15 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/process.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | '''
13 | Processes the feature vector values
14 | '''
15 |
16 | import time
17 | from features import size, order, assortativity, transitivity, degree, coreness, number_of_triangles, number_of_cliques, clique_number, clustering, edge_connectivity
18 | from save import save_feature
19 |
20 |
21 | def process_all(network, path_to_output):
22 | # create a new file to not make a mess with the past
23 | file_feature = open(path_to_output, 'w')
24 |
25 |
26 | # Size
27 | feature_name = 'Size'
28 | print("Calculating " + feature_name)
29 | f = size.calculate(network)
30 | save_feature(path_to_output, f, feature_name)
31 | if not f:
32 | print(feature_name + ' was 0!\n')
33 | print("Done! Time: " + time.strftime("%I:%M:%S"))
34 |
35 | # Order
36 | feature_name = 'Order'
37 | print("Calculating " + feature_name)
38 | f = order.calculate(network)
39 | save_feature(path_to_output, f, feature_name)
40 | if not f:
41 | print(feature_name + ' was 0!\n')
42 | print("Done! Time: " + time.strftime("%I:%M:%S"))
43 |
44 | # Assortativity
45 | feature_name = 'Assortativity'
46 | print("Calculating " + feature_name)
47 | f = assortativity.calculate(network)
48 | save_feature(path_to_output, f, feature_name)
49 | if not f:
50 | print(feature_name + ' was 0!\n')
51 | print("Done! Time: " + time.strftime("%I:%M:%S"))
52 |
53 | # Transitivity
54 | feature_name = 'Transitivity'
55 | print("Calculating " + feature_name)
56 | f = transitivity.calculate(network)
57 | save_feature(path_to_output, f, feature_name)
58 | if not f:
59 | print(feature_name + ' was 0!\n')
60 | print("Done! Time: " + time.strftime("%I:%M:%S"))
61 |
62 | # Degree
63 | feature_name = 'Degree'
64 | print("Calculating " + feature_name)
65 | f = degree.calculate(network)
66 | save_feature(path_to_output, f, feature_name)
67 | if not f:
68 | print(feature_name + ' was 0!\n')
69 | print("Done! Time: " + time.strftime("%I:%M:%S"))
70 |
71 | # Coreness
72 | feature_name = 'Coreness'
73 | print("Calculating " + feature_name)
74 | f = coreness.calculate(network)
75 | save_feature(path_to_output, f, feature_name)
76 | if not f:
77 | print(feature_name + ' was 0!\n')
78 | print("Done! Time: " + time.strftime("%I:%M:%S"))
79 |
80 | # number_of_triangles
81 | feature_name = 'Number_Triangles'
82 | print("Calculating " + feature_name)
83 | f = number_of_triangles.calculate(network)
84 | save_feature(path_to_output, f, feature_name)
85 | if not f:
86 | print(feature_name + ' was 0!\n')
87 | print("Done! Time: " + time.strftime("%I:%M:%S"))
88 |
89 | # number_of_cliques
90 | feature_name = 'Number_Cliques'
91 | print("Calculating " + feature_name)
92 | f = number_of_cliques.calculate(network)
93 | save_feature(path_to_output, f, feature_name)
94 | if not f:
95 | print(feature_name + ' was 0!\n')
96 | print("Done! Time: " + time.strftime("%I:%M:%S"))
97 |
98 | # clique_number
99 | feature_name = 'Clique_number'
100 | print("Calculating " + feature_name)
101 | f = clique_number.calculate(network)
102 | save_feature(path_to_output, f, feature_name)
103 | if not f:
104 | print(feature_name + ' was 0!\n')
105 | print("Done! Time: " + time.strftime("%I:%M:%S"))
106 |
107 | # clustering
108 | feature_name = 'Clustering'
109 | print("Calculating " + feature_name)
110 | f = clustering.calculate(network)
111 | save_feature(path_to_output, f, feature_name)
112 | if not f:
113 | print(feature_name + ' was 0!\n')
114 | print("Done! Time: " + time.strftime("%I:%M:%S"))
115 |
116 | # edge_connectivity
117 | feature_name = 'Edge_connectivity'
118 | print("Calculating " + feature_name)
119 | f = edge_connectivity.calculate(network)
120 | save_feature(path_to_output, f, feature_name)
121 | if not f:
122 | print(feature_name + ' was 0!\n')
123 | print("Done! Time: " + time.strftime("%I:%M:%S"))
124 |
125 |
126 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/running.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | import networkx as nx
14 | import os
15 | from process import process_all
16 | from constants import ORDER_SAMPLING, NUM_SAMPLES, PATH_2_GRAPH_SAMPLED, PATH_2_GRAPH_GLOBAL, PATH_2_FEATURES_SAMPLED, PATH_2_FEATURES_GLOBAL, PATH_2_OUTPUT
17 |
18 |
19 | PATH_2_GRAPH_GLOBAL = PATH_2_OUTPUT + PATH_2_GRAPH_GLOBAL
20 | PATH_2_GRAPH_SAMPLED = PATH_2_OUTPUT + PATH_2_GRAPH_SAMPLED
21 |
22 |
23 | PATH_2_FEATURES_SAMPLED = PATH_2_OUTPUT + PATH_2_FEATURES_SAMPLED
24 | PATH_2_FEATURES_GLOBAL = PATH_2_OUTPUT + PATH_2_FEATURES_GLOBAL
25 |
26 |
27 | def define_path_to_output(folder, net, n, s, r, j):
28 | if j:
29 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_' + str(j) + '_vector.dat'
30 | else:
31 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_vector.dat'
32 |
33 |
34 | def get_path_to_input(folder, net, n, s, r, j):
35 | if j:
36 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_' + str(j) + 'gpickle'
37 | else:
38 | return folder + net + n + '_' + str(s) + '_' + str(r) + '.gpickle'
39 |
40 |
41 |
42 | def process_feature(n, TYPE_NET_DIR, j):
43 |
44 | for r in range(NUM_SAMPLES):
45 |
46 | for s in ORDER_SAMPLING:
47 |
48 | path_to_net = get_path_to_input(PATH_2_GRAPH_SAMPLED, TYPE_NET_DIR, n, s ,r, j)
49 |
50 | if os.path.isfile(path_to_net):
51 | print 'Starting processing for ' + path_to_net
52 |
53 | network = nx.read_gpickle(path_to_net)
54 | path_to_output = define_path_to_output(PATH_2_FEATURES_SAMPLED, TYPE_NET_DIR, n, s, r, j)
55 |
56 | if not os.path.exists(PATH_2_FEATURES_SAMPLED):
57 | os.makedirs(PATH_2_FEATURES_SAMPLED)
58 | if not os.path.exists(PATH_2_FEATURES_SAMPLED + TYPE_NET_DIR):
59 | os.makedirs(PATH_2_FEATURES_SAMPLED+ TYPE_NET_DIR)
60 |
61 | process_all(network, path_to_output)
62 | print("All feature saved in the output file: " + path_to_output + '\n')
63 |
64 |
65 | path_to_net_error = get_path_to_input(PATH_2_GRAPH_GLOBAL, TYPE_NET_DIR , n, 0 ,0, j)
66 |
67 | if os.path.isfile(path_to_net_error):
68 | print 'Starting processing for ' + path_to_net
69 |
70 | network = nx.read_gpickle(path_to_net_error)
71 | path_to_output_error = define_path_to_output(PATH_2_FEATURES_GLOBAL, TYPE_NET_DIR, n, s, r, j)
72 |
73 | if not os.path.exists(PATH_2_FEATURES_GLOBAL):
74 | os.makedirs(PATH_2_FEATURES_GLOBAL)
75 | if not os.path.exists(PATH_2_FEATURES_GLOBAL+ TYPE_NET_DIR):
76 | os.makedirs(PATH_2_FEATURES_GLOBAL+ TYPE_NET_DIR)
77 |
78 | process_all(network, path_to_output_error)
79 | print("All feature saved in the output file: " + path_to_output_error + '\n')
80 |
81 |
82 |
83 |
84 | def sampling(NETWORK_FILES_DIR, TYPE_NET_DIR, NUMBER_OF_NETWORKS_DIR):
85 |
86 | if not os.path.exists(PATH_2_OUTPUT):
87 | os.makedirs(PATH_2_OUTPUT)
88 |
89 | for i, n in enumerate(NETWORK_FILES_DIR):
90 |
91 | if not NUMBER_OF_NETWORKS_DIR:
92 | process_feature(n, TYPE_NET_DIR, 0)
93 |
94 | else:
95 | num_net_here = NUMBER_OF_NETWORKS_DIR[i]
96 | for j in range(num_net_here):
97 | process_feature(n, TYPE_NET_DIR, j)
98 |
99 |
--------------------------------------------------------------------------------
/src/calculate_features/helpers/save.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | '''
15 | Save the feature vectors into a output file.
16 | '''
17 |
18 |
19 | def save_feature(path_to_output, feature_value, feature_name, last = False):
20 | file_feature = open(path_to_output, 'a')
21 | file_feature.write(feature_name + ': ')
22 | file_feature.write(str(feature_value) + '\n')
23 | if last:
24 | file_feature.write('\n****************************\n')
25 | file_feature.close()
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/calculate_features/location.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_LOCATION
17 | TYPE_NET_DIR = "location/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features/metabolic.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_METABOLIC
18 | TYPE_NET_DIR = "metabolic/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features/p2p.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_P2P
16 | TYPE_NET_DIR = "p2p/"
17 |
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features/products.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_PRODUCTS
17 | TYPE_NET_DIR = "products/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/calculate_features/road.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_ROAD
18 | TYPE_NET_DIR = "road/"
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/src/calculate_features/signed.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SIGNED
18 | TYPE_NET_DIR = "signed/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/calculate_features/social_I.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL
17 |
18 | TYPE_NET_DIR = "social/"
19 |
20 | NUMBER_OF_NETWORKS = [ 10, 973, 132]
21 |
22 |
23 |
24 |
25 | def main():
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, NUMBER_OF_NETWORKS)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/calculate_features/social_II.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL_II
16 | TYPE_NET_DIR = "social/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features/webgraphs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import constants, running
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WEBGRAPHS
17 | TYPE_NET_DIR = "webgraphs/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/src/calculate_features/wiki.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import constants, running
13 |
14 |
15 |
16 |
17 | # change here for type of net:
18 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WIKI
19 | TYPE_NET_DIR = "wiki/"
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/src/calculate_features/yeast.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import constants, running
15 |
16 | # change here for type of net:
17 | NETWORK_FILES= constants.NETWORK_FILES_UN_YEAST
18 | TYPE_NET_DIR = "yeast/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/atlas.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_ATLAS
16 | TYPE_NET_DIR = "atlas/"
17 |
18 |
19 | def main():
20 |
21 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
22 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
23 |
24 |
25 |
26 |
27 | if __name__ == '__main__':
28 | main()
29 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/auto.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_AUTO + constants.NETWORK_FILES_DIR_AUTO
16 | TYPE_NET_DIR = "auto/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/carbon.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 |
17 |
18 | # change here for type of net:
19 | NETWORK_FILES = constants.NETWORK_FILES_UN_CARBON
20 | TYPE_NET_DIR = "carbon/"
21 |
22 |
23 |
24 |
25 |
26 | def main():
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/cellular.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_CELLULAR
16 | TYPE_NET_DIR = "cellular/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/citation.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_CITATION
17 | TYPE_NET_DIR = "citation/"
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/collaboration.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net::
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_COLLABORATION
16 | TYPE_NET_DIR = "collaboration/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/communication.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_COMMUNICATION + constants.NETWORK_FILES_UN_COMMUNICATION
17 | TYPE_NET_DIR = "communication/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/ground.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_GROUND
18 | TYPE_NET_DIR = "ground/"
19 |
20 |
21 | def main():
22 |
23 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
24 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
25 |
26 |
27 |
28 |
29 | if __name__ == '__main__':
30 | main()
31 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/autistic-symposium/ml-graph-network-analyser-py/6d673e7dcf9058a5a41fa23d1d4e862a8ab45276/src/calculate_features_advanced/helpers/__init__.py
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/constants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | # Definition of some paths
14 | PATH_2_INPUT = "../../data/"
15 | PATH_2_OUTPUT = "../../output/"
16 | PATH_2_GRAPH_SAMPLED = "graphs_sampled/"
17 | PATH_2_GRAPH_GLOBAL = "graphs_global/"
18 | PATH_2_FEATURES_SAMPLED = "vector_sampled/"
19 | PATH_2_FEATURES_GLOBAL = "vector_global/"
20 |
21 |
22 | # How many samples to be sampled, this is a deprecated
23 | # feature since we introduced checking in the mhrw
24 | NUM_SAMPLES = 1
25 |
26 | # MHRW sampling, given by order
27 | ORDER_SAMPLING = [100, 300, 500, 1000, 2000]
28 | MIN_SIZE = [50, 150, 250, 500, 1000]
29 |
30 | # Files we want for each network.
31 | # This could be automatized, but we want to be able
32 | # to select some files manually, it can be automatized in the
33 | # future if time allows it.
34 |
35 | NETWORK_FILES_UN_YEAST = ["1.dat", '2.dat', '3.dat']
36 | NETWORK_FILES_UN_ATLAS = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat']
37 | NETWORK_FILES_UN_CARBON = ['out.foodweb-baydry', 'out.foodweb-baywet']
38 | NETWORK_FILES_UN_METABOLIC = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
39 | NETWORK_FILES_UN_CELLULAR = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
40 | NETWORK_FILES_DIR_SOCIAL_II = ["out.advogato", "out.dbpedia-occupation", "out.munmun_twitter_social", "out.petster-friendships-hamster", "out.petster-hamster", "out.slashdot-zoo", "out.ucidata-gama", "out.ucidata-zachary", "out.youtube-groupmemberships", "wiki-Vote.txt", "soc-Slashdot0902.txt", "soc-Slashdot0811.txt", "soc-Epinions1.txt"]
41 | NETWORK_FILES_DIR_SOCIAL = ["twitter", "gplus", "facebook"]
42 | NETWORK_FILES_UN_AUTO = ["as20000102.txt", "oregon1_010331.txt", "oregon1_010407.txt", "oregon1_010414.txt", "oregon1_010421.txt", "oregon1_010428.txt", "oregon1_010505.txt", "oregon1_010512.txt", "oregon1_010519.txt", "oregon1_010526.txt", "oregon2_010331.txt", "oregon2_010407.txt", "oregon2_010414.txt", "oregon2_010421.txt", "oregon2_010428.txt", "oregon2_010505.txt", "oregon2_010512.txt", "oregon2_010519.txt", "oregon2_010526.txt"]
43 | NETWORK_FILES_DIR_AUTO = ["as-caida20040105.txt", "as-caida20040202.txt", "as-caida20040301.txt", "as-caida20040405.txt", "as-caida20040503.txt", "as-caida20040607.txt", "as-caida20040705.txt", "as-caida20040802.txt", "as-caida20040906.txt", "as-caida20041004.txt", "as-caida20041101.txt", "as-caida20041206.txt", "as-caida20050103.txt", "as-caida20050207.txt", "as-caida20050307.txt", "as-caida20050404.txt", "as-caida20050502.txt", "as-caida20050606.txt", "as-caida20050704.txt", "as-caida20050801.txt", "as-caida20050905.txt", "as-caida20051003.txt", "as-caida20051107.txt", "as-caida20051205.txt", "as-caida20060102.txt", "as-caida20060109.txt", "as-caida20060116.txt", "as-caida20060123.txt", "as-caida20060130.txt", "as-caida20060206.txt", "as-caida20060213.txt", "as-caida20060220.txt", "as-caida20060227.txt", "as-caida20060306.txt", "as-caida20060313.txt", "as-caida20060320.txt", "as-caida20060327.txt", "as-caida20060403.txt", "as-caida20060410.txt", "as-caida20060417.txt", "as-caida20060424.txt", "as-caida20060501.txt", "as-caida20060508.txt", "as-caida20060515.txt", "as-caida20060522.txt", "as-caida20060529.txt", "as-caida20060605.txt", "as-caida20060612.txt", "as-caida20060619.txt", "as-caida20060626.txt", "as-caida20060703.txt", "as-caida20060710.txt", "as-caida20060717.txt", "as-caida20060724.txt", "as-caida20060731.txt", "as-caida20060807.txt", "as-caida20060814.txt", "as-caida20060821.txt", "as-caida20060828.txt", "as-caida20060904.txt", "as-caida20060911.txt", "as-caida20060918.txt", "as-caida20060925.txt", "as-caida20061002.txt", "as-caida20061009.txt", "as-caida20061016.txt", "as-caida20061023.txt", "as-caida20061030.txt", "as-caida20061106.txt", "as-caida20061113.txt", "as-caida20061120.txt", "as-caida20061127.txt", "as-caida20061204.txt", "as-caida20061211.txt", "as-caida20061218.txt", "as-caida20061225.txt", "as-caida20070101.txt", "as-caida20070108.txt", "as-caida20070115.txt", "as-caida20070122.txt", "as-caida20070129.txt", "as-caida20070205.txt", "as-caida20070212.txt", "as-caida20070219.txt", "as-caida20070226.txt", "as-caida20070305.txt", "as-caida20070312.txt", "as-caida20070319.txt", "as-caida20070326.txt", "as-caida20070402.txt", "as-caida20070409.txt", "as-caida20070416.txt", "as-caida20070423.txt", "as-caida20070430.txt", "as-caida20070507.txt", "as-caida20070514.txt", "as-caida20070521.txt", "as-caida20070528.txt", "as-caida20070604.txt", "as-caida20070611.txt", "as-caida20070618.txt", "as-caida20070625.txt", "as-caida20070702.txt", "as-caida20070709.txt", "as-caida20070716.txt", "as-caida20070723.txt", "as-caida20070730.txt", "as-caida20070806.txt", "as-caida20070813.txt", "as-caida20070820.txt", "as-caida20070827.txt", "as-caida20070903.txt", "as-caida20070910.txt", "as-caida20070917.txt", "as-caida20070924.txt", "as-caida20071001.txt", "as-caida20071008.txt", "as-caida20071015.txt", "as-caida20071022.txt", "as-caida20071029.txt", "as-caida20071105.txt", "as-caida20071112.txt"]
44 | NETWORK_FILES_DIR_CITATION = ["cit-HepPh.txt", "cit-HepTh.txt"]#, "cit-Patents.txt"]
45 | NETWORK_FILES_UN_COLLABORATION = ["ca-AstroPh.txt", "ca-CondMat.txt", "ca-GrQc.txt", "ca-HepPh.txt", "ca-HepTh.txt", "out.dblp-cite", "out.dbpedia-producer", "out.github", "out.opsahl-collaboration", "out.subelj_cora"]
46 | NETWORK_FILES_UN_COMMUNICATION = ["email-Enron.txt"]
47 | NETWORK_FILES_DIR_COMMUNICATION = ["email-EuAll.txt"]
48 | NETWORK_FILES_UN_GROUND = ["com-amazon.ungraph.txt", "com-dblp.ungraph.txt", "com-youtube.ungraph.txt"]#"com-lj.ungraph.txt", "com-orkut.ungraph.txt"]
49 | NETWORK_FILES_DIR_LOCATION = ["loc-brightkite_edges.txt", "loc-gowalla_edges.txt"]
50 | NETWORK_FILES_DIR_MEME = ["higgs-mention_network.edgelist", "higgs-reply_network.edgelist", "higgs-retweet_network.edgelist" ]
51 | NETWORK_FILES_DIR_ONLINECOM = ["flickrEdges.txt" ]
52 | NETWORK_FILES_DIR_P2P = ["p2p-Gnutella04.txt", "p2p-Gnutella05.txt", "p2p-Gnutella06.txt", "p2p-Gnutella08.txt", "p2p-Gnutella09.txt", "p2p-Gnutella24.txt", "p2p-Gnutella25.txt", "p2p-Gnutella30.txt", "p2p-Gnutella31.txt" ]
53 | NETWORK_FILES_DIR_PRODUCTS = ["amazon0302.txt", "amazon0312.txt", "amazon0505.txt", "amazon0601.txt"]
54 | NETWORK_FILES_UN_ROAD = ["roadNet-CA.txt", "roadNet-PA.txt", "roadNet-TX.txt","out.opsahl-openflights", "out.opsahl-powergrid", "out.opsahl-usairport", "out.subelj_euroroad"]
55 | NETWORK_FILES_DIR_SIGNED = ["soc-sign-epinions.txt", "soc-sign-Slashdot081106.txt", "soc-sign-Slashdot090216.txt", "soc-sign-Slashdot090221.txt"]#, "wikiElec.ElecBs3.txt"]
56 | NETWORK_FILES_DIR_WEBGRAPHS = ["web-NotreDame.txt", "web-Stanford.txt"]#
57 | NETWORK_FILES_DIR_WIKI = [ "wiki-Vote.txt"]#, "wikiElec.ElecBs3.txt"]
58 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/autistic-symposium/ml-graph-network-analyser-py/6d673e7dcf9058a5a41fa23d1d4e862a8ab45276/src/calculate_features_advanced/helpers/features/__init__.py
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/betweeness.py:
--------------------------------------------------------------------------------
1 | '''
2 |
3 | Betweenness centrality of a node v is the sum of the fraction of all-pairs shortest paths that pass through v.
4 |
5 | '''
6 | import networkx as nx
7 |
8 |
9 | def calculate(network):
10 | try:
11 | n = nx.betweenness_centrality(network)
12 | except:
13 | return 0
14 |
15 | if len(n.values()) == 0:
16 | return 0
17 | else:
18 | return round(sum(n.values())/len(n.values()), 7)
19 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/centrality.py:
--------------------------------------------------------------------------------
1 | '''
2 | Closeness centrality at a node is 1/average distance to all other nodes.
3 |
4 | The closeness centrality is normalized to to n-1 / size(G)-1 where n is the number of nodes in the connected part of graph containing the node. If the graph is not completely connected, this algorithm computes the closeness centrality for each connected part separately.
5 |
6 | It measures how fast information spreads from a given node to other reachable nodes in the graphs. For a node $u$, it represents the reciprocal of the average shortest path length between $u$ and every other reachable node in the graph:
7 |
8 | '''
9 | import networkx as nx
10 |
11 |
12 | def calculate(network):
13 | try:
14 | n = nx.closeness_centrality(network)
15 | except:
16 | return 0
17 |
18 | if len(n.values()) == 0:
19 | return 0
20 | else:
21 | return round(sum(n.values())/len(n.values()), 7)
22 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/communicability.py:
--------------------------------------------------------------------------------
1 | '''
2 | Communicability centrality, also called subgraph centrality, of a node n is the sum of closed walks of all lengths starting and ending at node n.
3 |
4 |
5 | '''
6 | import networkx as nx
7 |
8 |
9 |
10 | def calculate(network):
11 | try:
12 | n = nx.communicability_centrality(network)
13 | except:
14 | return 0
15 |
16 | if len(n.values()) == 0:
17 | return 0
18 | else:
19 | return round(sum(n.values())/len(n.values()), 7)
20 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/density.py:
--------------------------------------------------------------------------------
1 | '''
2 | Return the density of a graph.
3 | '''
4 |
5 | import networkx as nx
6 |
7 |
8 |
9 | def calculate(network):
10 | try:
11 | n = nx.density(network)
12 | except:
13 | return 0
14 |
15 | return round(n, 7)
16 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/diameter.py:
--------------------------------------------------------------------------------
1 | '''
2 | Return the diameter of the graph G.
3 | '''
4 |
5 | import networkx as nx
6 |
7 |
8 |
9 | def calculate(network):
10 | try:
11 | n = nx.diameter(network)
12 | except:
13 | return 0
14 |
15 | return round(n, 7)
16 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/eccentricity.py:
--------------------------------------------------------------------------------
1 | '''
2 |
3 | The eccentricity of a node v is the maximum distance from v to all other nodes in G.
4 | '''
5 |
6 | import networkx as nx
7 |
8 | def calculate(network):
9 | try:
10 | n = nx.eccentricity(network)
11 | except:
12 | return 0
13 |
14 | if len(n.values()) == 0:
15 | return 0
16 | else:
17 | return round(sum(n.values())/len(n.values()), 7)
18 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/node_connectivity.py:
--------------------------------------------------------------------------------
1 |
2 | '''
3 | Node connectivity is equal to the minimum number of nodes that must be removed to disconnect G or render it trivial. If source and target nodes are provided, this function returns the local node connectivity.
4 |
5 | Returns the average connectivity of a graph G.
6 | '''
7 |
8 | import networkx as nx
9 |
10 |
11 | def calculate(network):
12 | try:
13 | n = nx.average_node_connectivity(network)
14 | except:
15 | return 0
16 |
17 | return round(n, 7)
18 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/pagerank.py:
--------------------------------------------------------------------------------
1 | '''
2 |
3 | Return the PageRank of the nodes in the graph.
4 |
5 | PageRank computes a ranking of the nodes in the graph G based on the structure of the incoming links. It was originally designed as an algorithm to rank web pages.
6 |
7 |
8 | '''
9 | import networkx as nx
10 |
11 |
12 | def calculate(network):
13 | try:
14 | n = nx.pagerank_numpy(network)
15 | except:
16 | return 0
17 |
18 | if len(n.values()) == 0:
19 | return 0
20 | else:
21 | return round(sum(n.values())/len(n.values()), 7)
22 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/radius.py:
--------------------------------------------------------------------------------
1 | '''
2 |
3 | The radius is the minimum eccentricity.
4 | '''
5 |
6 | import networkx as nx
7 |
8 |
9 |
10 | def calculate(network):
11 | try:
12 | n = nx.radius(network)
13 | except:
14 | return 0
15 |
16 | return round(n, 7)
17 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/features/square_clustering.py:
--------------------------------------------------------------------------------
1 | '''
2 | Compute the squares clustering coefficient for nodes: the fraction of possible squares that exist at the node.
3 |
4 | '''
5 |
6 |
7 | import networkx as nx
8 |
9 |
10 |
11 |
12 | def calculate(network):
13 | try:
14 | n = nx.square_clustering(network)
15 | except:
16 | return 0
17 |
18 | if len(n.values()) == 0:
19 | return 0
20 | else:
21 | return round(sum(n.values())/len(n.values()), 7)
22 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/process.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | '''
13 | Processes the feature vector values
14 | '''
15 |
16 | import time
17 | from features import betweeness, centrality, communicability, density, diameter, eccentricity, node_connectivity, pagerank, radius, square_clustering
18 | from save import save_feature
19 |
20 |
21 | def process_all(network, path_to_output):
22 |
23 |
24 |
25 | # betweeness
26 | feature_name = 'Betweeness'
27 | print("Calculating " + feature_name)
28 | f = betweeness.calculate(network)
29 | save_feature(path_to_output, f, feature_name)
30 | if not f:
31 | print(feature_name + ' was 0!\n')
32 | print("Done! Time: " + time.strftime("%I:%M:%S"))
33 |
34 | # centrality
35 | feature_name = 'Centrality'
36 | print("Calculating " + feature_name)
37 | f = centrality.calculate(network)
38 | save_feature(path_to_output, f, feature_name)
39 | if not f:
40 | print(feature_name + ' was 0!\n')
41 | print("Done! Time: " + time.strftime("%I:%M:%S"))
42 |
43 | # communicability,
44 | feature_name = 'Communicability'
45 | print("Calculating " + feature_name)
46 | f = communicability.calculate(network)
47 | save_feature(path_to_output, f, feature_name)
48 | if not f:
49 | print(feature_name + ' was 0!\n')
50 | print("Done! Time: " + time.strftime("%I:%M:%S"))
51 |
52 | # density,
53 | feature_name = 'Density'
54 | print("Calculating " + feature_name)
55 | f = density.calculate(network)
56 | save_feature(path_to_output, f, feature_name)
57 | if not f:
58 | print(feature_name + ' was 0!\n')
59 | print("Done! Time: " + time.strftime("%I:%M:%S"))
60 |
61 | # diameter,
62 | feature_name = 'Diameter'
63 | print("Calculating " + feature_name)
64 | f = diameter.calculate(network)
65 | save_feature(path_to_output, f, feature_name)
66 | if not f:
67 | print(feature_name + ' was 0!\n')
68 | print("Done! Time: " + time.strftime("%I:%M:%S"))
69 |
70 | # eccentricity,
71 | feature_name = 'Eccentricity'
72 | print("Calculating " + feature_name)
73 | f = eccentricity.calculate(network)
74 | save_feature(path_to_output, f, feature_name)
75 | if not f:
76 | print(feature_name + ' was 0!\n')
77 | print("Done! Time: " + time.strftime("%I:%M:%S"))
78 |
79 | # node_connectivity,
80 | feature_name = 'Node_connectivity'
81 | print("Calculating " + feature_name)
82 | f = node_connectivity.calculate(network)
83 | save_feature(path_to_output, f, feature_name)
84 | if not f:
85 | print(feature_name + ' was 0!\n')
86 | print("Done! Time: " + time.strftime("%I:%M:%S"))
87 |
88 | # pagerank,
89 | feature_name = 'Pagerank'
90 | print("Calculating " + feature_name)
91 | f = pagerank.calculate(network)
92 | save_feature(path_to_output, f, feature_name)
93 | if not f:
94 | print(feature_name + ' was 0!\n')
95 | print("Done! Time: " + time.strftime("%I:%M:%S"))
96 |
97 | # radius,
98 | feature_name = 'Radius'
99 | print("Calculating " + feature_name)
100 | f = radius.calculate(network)
101 | save_feature(path_to_output, f, feature_name)
102 | if not f:
103 | print(feature_name + ' was 0!\n')
104 | print("Done! Time: " + time.strftime("%I:%M:%S"))
105 |
106 | # square_clustering
107 | feature_name = 'Square_clustering'
108 | print("Calculating " + feature_name)
109 | f = square_clustering.calculate(network)
110 | save_feature(path_to_output, f, feature_name)
111 | if not f:
112 | print(feature_name + ' was 0!\n')
113 | print("Done! Time: " + time.strftime("%I:%M:%S"))
114 |
115 |
116 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/running.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | import networkx as nx
14 | import os
15 | from process import process_all
16 | from constants import ORDER_SAMPLING, NUM_SAMPLES, PATH_2_GRAPH_SAMPLED, PATH_2_GRAPH_GLOBAL, PATH_2_FEATURES_SAMPLED, PATH_2_FEATURES_GLOBAL, PATH_2_OUTPUT
17 |
18 |
19 | PATH_2_GRAPH_GLOBAL = PATH_2_OUTPUT + PATH_2_GRAPH_GLOBAL
20 | PATH_2_GRAPH_SAMPLED = PATH_2_OUTPUT + PATH_2_GRAPH_SAMPLED
21 |
22 |
23 | PATH_2_FEATURES_SAMPLED = PATH_2_OUTPUT + PATH_2_FEATURES_SAMPLED
24 | PATH_2_FEATURES_GLOBAL = PATH_2_OUTPUT + PATH_2_FEATURES_GLOBAL
25 |
26 |
27 | def define_path_to_output(folder, net, n, s, r, j):
28 | if j:
29 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_' + str(j) + '_vector.dat'
30 | else:
31 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_vector.dat'
32 |
33 |
34 | def get_path_to_input(folder, net, n, s, r, j):
35 | if j:
36 | return folder + net + n + '_' + str(s) + '_' + str(r) + '_' + str(j) + 'gpickle'
37 | else:
38 | return folder + net + n + '_' + str(s) + '_' + str(r) + '.gpickle'
39 |
40 |
41 |
42 | def process_feature(n, TYPE_NET_DIR, j):
43 |
44 | for r in range(NUM_SAMPLES):
45 |
46 | for s in ORDER_SAMPLING:
47 |
48 | path_to_net = get_path_to_input(PATH_2_GRAPH_SAMPLED, TYPE_NET_DIR, n, s ,r, j)
49 |
50 | if os.path.isfile(path_to_net):
51 | print 'Starting processing for ' + path_to_net
52 |
53 | network = nx.read_gpickle(path_to_net)
54 | path_to_output = define_path_to_output(PATH_2_FEATURES_SAMPLED, TYPE_NET_DIR, n, s, r, j)
55 |
56 | if not os.path.exists(PATH_2_FEATURES_SAMPLED):
57 | os.makedirs(PATH_2_FEATURES_SAMPLED)
58 | if not os.path.exists(PATH_2_FEATURES_SAMPLED + TYPE_NET_DIR):
59 | os.makedirs(PATH_2_FEATURES_SAMPLED+ TYPE_NET_DIR)
60 |
61 | process_all(network, path_to_output)
62 | print("All feature saved in the output file: " + path_to_output + '\n')
63 |
64 |
65 | path_to_net_error = get_path_to_input(PATH_2_GRAPH_GLOBAL, TYPE_NET_DIR , n, 0 ,0, j)
66 |
67 | if os.path.isfile(path_to_net_error):
68 | print 'Starting processing for ' + path_to_net
69 |
70 | network = nx.read_gpickle(path_to_net_error)
71 | path_to_output_error = define_path_to_output(PATH_2_FEATURES_GLOBAL, TYPE_NET_DIR, n, s, r, j)
72 |
73 | if not os.path.exists(PATH_2_FEATURES_GLOBAL):
74 | os.makedirs(PATH_2_FEATURES_GLOBAL)
75 | if not os.path.exists(PATH_2_FEATURES_GLOBAL+ TYPE_NET_DIR):
76 | os.makedirs(PATH_2_FEATURES_GLOBAL+ TYPE_NET_DIR)
77 |
78 | process_all(network, path_to_output_error)
79 | print("All feature saved in the output file: " + path_to_output_error + '\n')
80 |
81 |
82 |
83 |
84 | def sampling(NETWORK_FILES_DIR, TYPE_NET_DIR, NUMBER_OF_NETWORKS_DIR):
85 |
86 | if not os.path.exists(PATH_2_OUTPUT):
87 | os.makedirs(PATH_2_OUTPUT)
88 |
89 | for i, n in enumerate(NETWORK_FILES_DIR):
90 |
91 | if not NUMBER_OF_NETWORKS_DIR:
92 | process_feature(n, TYPE_NET_DIR, 0)
93 |
94 | else:
95 | num_net_here = NUMBER_OF_NETWORKS_DIR[i]
96 | for j in range(num_net_here):
97 | process_feature(n, TYPE_NET_DIR, j)
98 |
99 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/helpers/save.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | '''
15 | Save the feature vectors into a output file.
16 | '''
17 |
18 |
19 | def save_feature(path_to_output, feature_value, feature_name, last = False):
20 | file_feature = open(path_to_output, 'a')
21 | file_feature.write(feature_name + ': ')
22 | file_feature.write(str(feature_value) + '\n')
23 | if last:
24 | file_feature.write('\n****************************\n')
25 | file_feature.close()
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/location.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_LOCATION
17 | TYPE_NET_DIR = "location/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/metabolic.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_METABOLIC
18 | TYPE_NET_DIR = "metabolic/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/p2p.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_P2P
16 | TYPE_NET_DIR = "p2p/"
17 |
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/products.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_PRODUCTS
17 | TYPE_NET_DIR = "products/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/road.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_ROAD
18 | TYPE_NET_DIR = "road/"
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/signed.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SIGNED
18 | TYPE_NET_DIR = "signed/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/social_I.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL
17 |
18 | TYPE_NET_DIR = "social/"
19 |
20 | NUMBER_OF_NETWORKS = [ 10, 973, 132]
21 |
22 |
23 |
24 |
25 | def main():
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, NUMBER_OF_NETWORKS)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/social_II.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL_II
16 | TYPE_NET_DIR = "social/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/webgraphs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import constants, running
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WEBGRAPHS
17 | TYPE_NET_DIR = "webgraphs/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/wiki.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import constants, running
13 |
14 |
15 |
16 |
17 | # change here for type of net:
18 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WIKI
19 | TYPE_NET_DIR = "wiki/"
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/src/calculate_features_advanced/yeast.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import constants, running
15 |
16 | # change here for type of net:
17 | NETWORK_FILES= constants.NETWORK_FILES_UN_YEAST
18 | TYPE_NET_DIR = "yeast/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR, [])
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/src/make_normalization/atlas.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_ATLAS
16 | TYPE_NET_DIR = "atlas/"
17 |
18 |
19 | def main():
20 |
21 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
22 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
23 |
24 |
25 |
26 |
27 | if __name__ == '__main__':
28 | main()
29 |
--------------------------------------------------------------------------------
/src/make_normalization/auto.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_AUTO + constants.NETWORK_FILES_DIR_AUTO
16 | TYPE_NET_DIR = "auto/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/make_normalization/carbon.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 |
17 |
18 | # change here for type of net:
19 | NETWORK_FILES = constants.NETWORK_FILES_UN_CARBON
20 | TYPE_NET_DIR = "carbon/"
21 |
22 |
23 |
24 |
25 |
26 | def main():
27 |
28 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
29 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/src/make_normalization/cellular.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_CELLULAR
16 | TYPE_NET_DIR = "cellular/"
17 |
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/make_normalization/citation.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_CITATION
17 | TYPE_NET_DIR = "citation/"
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/make_normalization/collaboration.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net::
15 | NETWORK_FILES = constants.NETWORK_FILES_UN_COLLABORATION
16 | TYPE_NET_DIR = "collaboration/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/make_normalization/communication.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_COMMUNICATION + constants.NETWORK_FILES_UN_COMMUNICATION
17 | TYPE_NET_DIR = "communication/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/make_normalization/ground.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_GROUND
18 | TYPE_NET_DIR = "ground/"
19 |
20 |
21 | def main():
22 |
23 |
24 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
25 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
26 |
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/make_normalization/helpers/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['constants', 'mhrw', 'running', 'snowball']
--------------------------------------------------------------------------------
/src/make_normalization/helpers/constants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | # Definition of some paths
14 | PATH_2_INPUT = "../../data/"
15 | PATH_2_OUTPUT = "../../output/"
16 | PATH_2_GRAPH_SAMPLED = "graphs_sampled/"
17 | PATH_2_GRAPH_GLOBAL = "graphs_global/"
18 | PATH_2_FEATURES_SAMPLED = "vector_sampled/"
19 | PATH_2_FEATURES_GLOBAL = "vector_global/"
20 |
21 |
22 | # How many samples to be sampled, this is a deprecated
23 | # feature since we introduced checking in the mhrw
24 | NUM_SAMPLES = 1
25 |
26 | # MHRW sampling, given by order
27 | ORDER_SAMPLING = [100, 300, 500, 1000, 2000]
28 | MIN_SIZE = [50, 150, 250, 500, 1000]
29 |
30 | # Files we want for each network.
31 | # This could be automatized, but we want to be able
32 | # to select some files manually, it can be automatized in the
33 | # future if time allows it.
34 |
35 | NETWORK_FILES_UN_YEAST = ["1.dat", '2.dat', '3.dat']
36 | NETWORK_FILES_UN_ATLAS = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat']
37 | NETWORK_FILES_UN_CARBON = ['out.foodweb-baydry', 'out.foodweb-baywet']
38 | NETWORK_FILES_UN_METABOLIC = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
39 | NETWORK_FILES_UN_CELLULAR = ['1.dat', '2.dat', '3.dat', '4.dat', '5.dat', '6.dat', '7.dat', '8.dat', '9.dat', '10.dat', '11.dat', '12.dat', '13.dat', '14.dat', '15.dat', '16.dat', '17.dat', '18.dat', '19.dat', '20.dat', '21.dat', '22.dat', '23.dat', '24.dat', '25.dat', '26.dat', '27.dat', '28.dat', '29.dat', '30.dat', '31.dat', '32.dat', '33.dat', '34.dat','35.dat','36.dat','37.dat','38.dat','39.dat', '40.dat','41.dat','42.dat','43.dat' ]
40 | NETWORK_FILES_DIR_SOCIAL_II = ["out.advogato", "out.dbpedia-occupation", "out.munmun_twitter_social", "out.petster-friendships-hamster", "out.petster-hamster", "out.slashdot-zoo", "out.ucidata-gama", "out.ucidata-zachary", "out.youtube-groupmemberships", "wiki-Vote.txt", "soc-Slashdot0902.txt", "soc-Slashdot0811.txt", "soc-Epinions1.txt"]
41 | NETWORK_FILES_DIR_SOCIAL = ["twitter", "gplus", "facebook"]
42 | NETWORK_FILES_UN_AUTO = ["as20000102.txt", "oregon1_010331.txt", "oregon1_010407.txt", "oregon1_010414.txt", "oregon1_010421.txt", "oregon1_010428.txt", "oregon1_010505.txt", "oregon1_010512.txt", "oregon1_010519.txt", "oregon1_010526.txt", "oregon2_010331.txt", "oregon2_010407.txt", "oregon2_010414.txt", "oregon2_010421.txt", "oregon2_010428.txt", "oregon2_010505.txt", "oregon2_010512.txt", "oregon2_010519.txt", "oregon2_010526.txt"]
43 | NETWORK_FILES_DIR_AUTO = ["as-caida20040105.txt", "as-caida20040202.txt", "as-caida20040301.txt", "as-caida20040405.txt", "as-caida20040503.txt", "as-caida20040607.txt", "as-caida20040705.txt", "as-caida20040802.txt", "as-caida20040906.txt", "as-caida20041004.txt", "as-caida20041101.txt", "as-caida20041206.txt", "as-caida20050103.txt", "as-caida20050207.txt", "as-caida20050307.txt", "as-caida20050404.txt", "as-caida20050502.txt", "as-caida20050606.txt", "as-caida20050704.txt", "as-caida20050801.txt", "as-caida20050905.txt", "as-caida20051003.txt", "as-caida20051107.txt", "as-caida20051205.txt", "as-caida20060102.txt", "as-caida20060109.txt", "as-caida20060116.txt", "as-caida20060123.txt", "as-caida20060130.txt", "as-caida20060206.txt", "as-caida20060213.txt", "as-caida20060220.txt", "as-caida20060227.txt", "as-caida20060306.txt", "as-caida20060313.txt", "as-caida20060320.txt", "as-caida20060327.txt", "as-caida20060403.txt", "as-caida20060410.txt", "as-caida20060417.txt", "as-caida20060424.txt", "as-caida20060501.txt", "as-caida20060508.txt", "as-caida20060515.txt", "as-caida20060522.txt", "as-caida20060529.txt", "as-caida20060605.txt", "as-caida20060612.txt", "as-caida20060619.txt", "as-caida20060626.txt", "as-caida20060703.txt", "as-caida20060710.txt", "as-caida20060717.txt", "as-caida20060724.txt", "as-caida20060731.txt", "as-caida20060807.txt", "as-caida20060814.txt", "as-caida20060821.txt", "as-caida20060828.txt", "as-caida20060904.txt", "as-caida20060911.txt", "as-caida20060918.txt", "as-caida20060925.txt", "as-caida20061002.txt", "as-caida20061009.txt", "as-caida20061016.txt", "as-caida20061023.txt", "as-caida20061030.txt", "as-caida20061106.txt", "as-caida20061113.txt", "as-caida20061120.txt", "as-caida20061127.txt", "as-caida20061204.txt", "as-caida20061211.txt", "as-caida20061218.txt", "as-caida20061225.txt", "as-caida20070101.txt", "as-caida20070108.txt", "as-caida20070115.txt", "as-caida20070122.txt", "as-caida20070129.txt", "as-caida20070205.txt", "as-caida20070212.txt", "as-caida20070219.txt", "as-caida20070226.txt", "as-caida20070305.txt", "as-caida20070312.txt", "as-caida20070319.txt", "as-caida20070326.txt", "as-caida20070402.txt", "as-caida20070409.txt", "as-caida20070416.txt", "as-caida20070423.txt", "as-caida20070430.txt", "as-caida20070507.txt", "as-caida20070514.txt", "as-caida20070521.txt", "as-caida20070528.txt", "as-caida20070604.txt", "as-caida20070611.txt", "as-caida20070618.txt", "as-caida20070625.txt", "as-caida20070702.txt", "as-caida20070709.txt", "as-caida20070716.txt", "as-caida20070723.txt", "as-caida20070730.txt", "as-caida20070806.txt", "as-caida20070813.txt", "as-caida20070820.txt", "as-caida20070827.txt", "as-caida20070903.txt", "as-caida20070910.txt", "as-caida20070917.txt", "as-caida20070924.txt", "as-caida20071001.txt", "as-caida20071008.txt", "as-caida20071015.txt", "as-caida20071022.txt", "as-caida20071029.txt", "as-caida20071105.txt", "as-caida20071112.txt"]
44 | NETWORK_FILES_DIR_CITATION = ["cit-HepPh.txt", "cit-HepTh.txt"]#, "cit-Patents.txt"]
45 | NETWORK_FILES_UN_COLLABORATION = ["ca-AstroPh.txt", "ca-CondMat.txt", "ca-GrQc.txt", "ca-HepPh.txt", "ca-HepTh.txt", "out.dblp-cite", "out.dbpedia-producer", "out.github", "out.opsahl-collaboration", "out.subelj_cora"]
46 | NETWORK_FILES_UN_COMMUNICATION = ["email-Enron.txt"]
47 | NETWORK_FILES_DIR_COMMUNICATION = ["email-EuAll.txt"]
48 | NETWORK_FILES_UN_GROUND = ["com-amazon.ungraph.txt", "com-dblp.ungraph.txt", "com-youtube.ungraph.txt"]#"com-lj.ungraph.txt", "com-orkut.ungraph.txt"]
49 | NETWORK_FILES_DIR_LOCATION = ["loc-brightkite_edges.txt", "loc-gowalla_edges.txt"]
50 | NETWORK_FILES_DIR_MEME = ["higgs-mention_network.edgelist", "higgs-reply_network.edgelist", "higgs-retweet_network.edgelist" ]
51 | NETWORK_FILES_DIR_ONLINECOM = ["flickrEdges.txt" ]
52 | NETWORK_FILES_DIR_P2P = ["p2p-Gnutella04.txt", "p2p-Gnutella05.txt", "p2p-Gnutella06.txt", "p2p-Gnutella08.txt", "p2p-Gnutella09.txt", "p2p-Gnutella24.txt", "p2p-Gnutella25.txt", "p2p-Gnutella30.txt", "p2p-Gnutella31.txt" ]
53 | NETWORK_FILES_DIR_PRODUCTS = ["amazon0302.txt", "amazon0312.txt", "amazon0505.txt", "amazon0601.txt"]
54 | NETWORK_FILES_UN_ROAD = ["roadNet-CA.txt", "roadNet-PA.txt", "roadNet-TX.txt","out.opsahl-openflights", "out.opsahl-powergrid", "out.opsahl-usairport", "out.subelj_euroroad"]
55 | NETWORK_FILES_DIR_SIGNED = ["soc-sign-epinions.txt", "soc-sign-Slashdot081106.txt", "soc-sign-Slashdot090216.txt", "soc-sign-Slashdot090221.txt"]#, "wikiElec.ElecBs3.txt"]
56 | NETWORK_FILES_DIR_WEBGRAPHS = ["web-NotreDame.txt", "web-Stanford.txt"]#
57 | NETWORK_FILES_DIR_WIKI = [ "wiki-Vote.txt"]#, "wikiElec.ElecBs3.txt"]
58 |
--------------------------------------------------------------------------------
/src/make_normalization/helpers/mhrw.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import networkx as nx
4 | import random
5 |
6 |
7 | __author__ = "Mari Wahl"
8 | __copyright__ = "Copyright 2014, The Cogent Project"
9 | __credits__ = ["Mari Wahl"]
10 | __license__ = "GPL"
11 | __version__ = "4.1"
12 | __maintainer__ = "Mari Wahl"
13 | __email__ = "marina.w4hl@gmail.com"
14 |
15 |
16 |
17 |
18 | def mhrw_sampling(network, desired_order):
19 | ''' MHRV algorithm '''
20 |
21 | # variables here
22 | g = nx.Graph()
23 | order = 0
24 | go_more = True
25 |
26 | # Try to get the first node that is not isolated
27 | trycount = 0
28 | found_node = False
29 |
30 | while trycount < 10 and not found_node:
31 | v = random.choice(network.nodes())
32 | neighbors = nx.neighbors(network, v)
33 | if not neighbors:
34 | trycount += 1
35 | else:
36 | found_node = True
37 |
38 | # if didnt find the node, just return
39 | if not found_node:
40 | return False, g, 0
41 |
42 | # now, with the first node, we start our graph
43 | g.add_node(v)
44 |
45 | while order < desired_order and go_more:
46 |
47 | # If don't find more neighboors, but almost have the order
48 | neighbors = nx.neighbors(network, v)
49 | if not neighbors:
50 | if order < 0.9*desired_order:
51 | return False, g, order
52 | else:
53 | return True, g, order
54 |
55 | # If find neighboors keep going
56 | for i in range(len(neighbors)):
57 | g.add_edge(v, neighbors[i])
58 |
59 | order_new = g.order()
60 | # If we are too big now (more than 30%), lets try again
61 | if order_new > 1.3*desired_order:
62 | return False, g, order
63 |
64 | # or If we reach the order we want
65 | if order_new >= desired_order:
66 | go_more = False
67 |
68 | # If nothing happened, keep going...
69 | v = random.choice(neighbors)
70 | order = order_new
71 |
72 | return True, g, order
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | def make_sample(network, desired_order, desired_min_size, desired_attempt=20):
81 | '''
82 | This is the main function, we get a network and a desired size and try to make the samples.
83 | '''
84 |
85 | # Check whether the graph is large enough, if not, just reproduce it
86 | net_order = network.order()
87 | if network.order() < desired_order:
88 | print ('COPYING THE ORGINAL GRAPH!')
89 | return network, False, net_order
90 |
91 |
92 | # Create counter variables
93 | attempt = 0
94 | worked = False
95 |
96 | # Try to get the graph sample
97 | while attempt < desired_attempt and not worked:
98 | attempt += 1
99 | worked, g, order = mhrw_sampling(network, desired_order)
100 |
101 | if g.size() >= desired_min_size or attempt < desired_attempt:
102 | print ("IT WORKED!")
103 | return g, True, order
104 |
105 | else:
106 | print("I'M AFFRAID IT DIDN'T WORK, JAMES")
107 | return network, False, net_order
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/src/make_normalization/helpers/running.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | import networkx as nx
13 | import os
14 | import mhrw
15 | from constants import ORDER_SAMPLING, NUM_SAMPLES, PATH_2_OUTPUT, PATH_2_INPUT, PATH_2_GRAPH_GLOBAL, PATH_2_GRAPH_SAMPLED, MIN_SIZE
16 |
17 | PATH_2_GRAPH_GLOBAL = PATH_2_OUTPUT + PATH_2_GRAPH_GLOBAL
18 | PATH_2_GRAPH_SAMPLED = PATH_2_OUTPUT + PATH_2_GRAPH_SAMPLED
19 |
20 | '''
21 | Here we define the sampling function. Note that we have some special cases that need some
22 | handling, and that's why they are defined slightly different.
23 | We also handle directed and undirected graphs here. We could have another step/module just for this
24 | but it became natural to just incorporate in these functions.
25 | '''
26 |
27 | def define_path_to_input(net, n, j):
28 | if j:
29 | return PATH_2_INPUT + net + n + j +'gpickle.1'
30 | else:
31 | return PATH_2_INPUT + net + n + 'gpickle.1'
32 |
33 |
34 | def define_path_to_output(PATH, net, n, s, r, j):
35 | if j:
36 | return PATH + net + n + '_' + str(s) + '_' + str(r) + '_' + j + 'gpickle'
37 | else:
38 | return PATH + net + n + '_' + str(s) + '_' + str(r) + '.gpickle'
39 |
40 |
41 |
42 | def running(path_to_input, net_name, n, j):
43 | '''
44 | Run the sampling and save the resulting graphs (or log errors if not possible to sample)
45 | '''
46 | network = nx.read_gpickle(path_to_input)
47 | network = network.to_undirected()
48 |
49 | print '\n ----- Starting to compute ' + path_to_input + ' -----'
50 |
51 | for r in range(NUM_SAMPLES):
52 |
53 | for s_count, s in enumerate(ORDER_SAMPLING):
54 | if network.order() < s:
55 | record_global = True
56 | else:
57 | record_global = False
58 | net, print_please, order_net = mhrw.make_sample(network, s, MIN_SIZE[s_count])
59 |
60 | if print_please:
61 | path_to_output = define_path_to_output(PATH_2_GRAPH_SAMPLED, net_name, n, s, r, j)
62 |
63 | if not os.path.exists(PATH_2_GRAPH_SAMPLED):
64 | os.makedirs(PATH_2_GRAPH_SAMPLED)
65 | if not os.path.exists(PATH_2_GRAPH_SAMPLED + net_name):
66 | os.makedirs(PATH_2_GRAPH_SAMPLED + net_name)
67 |
68 | nx.write_gpickle(net, path_to_output)
69 | print("Sample " + str(r) + " generated at " + path_to_output)
70 | print("For desired order: " + str(s) + ', we had resulting order: ' + str(order_net))
71 |
72 | else:
73 | record_global = True
74 |
75 | if record_global:
76 | path_to_output_error = define_path_to_output(PATH_2_GRAPH_GLOBAL, net_name, n, 0, 0, j)
77 | if not os.path.exists(PATH_2_GRAPH_GLOBAL):
78 | os.makedirs(PATH_2_GRAPH_GLOBAL)
79 | if not os.path.exists(PATH_2_GRAPH_GLOBAL + net_name):
80 | os.makedirs(PATH_2_GRAPH_GLOBAL + net_name)
81 |
82 | nx.write_gpickle(network, path_to_output_error)
83 | print("Sample " + str(r) + ", for desired order: " + str(s) + " did not work...")
84 | print("Because of this, the entire graph was saved at " + path_to_output_error)
85 |
86 |
87 |
88 |
89 |
90 |
91 | def sampling_tar(NETWORK_FILES, TYPE_NET_DIR, NUMBER_OF_NETWORKS):
92 | ''' This function is for the social network graphs that were obtained in tar format, such as twitter,
93 | facebook, g+, etc. Here we deal with the directed graphs.
94 | '''
95 | if not os.path.exists(PATH_2_OUTPUT):
96 | os.makedirs(PATH_2_OUTPUT)
97 |
98 | for i, n in enumerate(NETWORK_FILES):
99 | net_here = NUMBER_OF_NETWORKS[i]
100 | print net_here
101 | for j in range(net_here):
102 | print j
103 | path_to_input = define_path_to_input(TYPE_NET_DIR, n, str(j))
104 | running(path_to_input, TYPE_NET_DIR, n, str(j))
105 |
106 |
107 |
108 | def sampling(NETWORK_FILES, TYPE_NET_DIR):
109 | if not os.path.exists(PATH_2_OUTPUT):
110 | os.makedirs(PATH_2_OUTPUT)
111 |
112 | for n in NETWORK_FILES:
113 | path_to_input = define_path_to_input(TYPE_NET_DIR, n, "")
114 | running(path_to_input, TYPE_NET_DIR, n, '')
115 |
116 |
--------------------------------------------------------------------------------
/src/make_normalization/location.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_LOCATION
17 | TYPE_NET_DIR = "location/"
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/make_normalization/metabolic.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_METABOLIC
18 | TYPE_NET_DIR = "metabolic/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/make_normalization/p2p.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_P2P
16 | TYPE_NET_DIR = "p2p/"
17 |
18 |
19 |
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 | if __name__ == '__main__':
33 | main()
34 |
--------------------------------------------------------------------------------
/src/make_normalization/products.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_PRODUCTS
17 | TYPE_NET_DIR = "products/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 | if __name__ == '__main__':
31 | main()
32 |
--------------------------------------------------------------------------------
/src/make_normalization/road.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import running, constants
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_UN_ROAD
18 | TYPE_NET_DIR = "road/"
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
26 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/src/make_normalization/signed.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 |
16 | # change here for type of net:
17 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SIGNED
18 | TYPE_NET_DIR = "signed/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/make_normalization/social_I.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import running, constants
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL
17 |
18 | TYPE_NET_DIR = "social/"
19 |
20 | NUMBER_OF_NETWORKS = [ 10, 973, 132]
21 |
22 |
23 |
24 |
25 | def main():
26 |
27 | running.sampling_tar(NETWORK_FILES, TYPE_NET_DIR, NUMBER_OF_NETWORKS)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/make_normalization/social_II.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import running, constants
13 |
14 | # change here for type of net:
15 | NETWORK_FILES = constants.NETWORK_FILES_DIR_SOCIAL_II
16 | TYPE_NET_DIR = "social/"
17 |
18 |
19 | def main():
20 |
21 |
22 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
23 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
24 |
25 |
26 |
27 |
28 | if __name__ == '__main__':
29 | main()
30 |
--------------------------------------------------------------------------------
/src/make_normalization/webgraphs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 | from helpers import constants, running
14 |
15 | # change here for type of net:
16 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WEBGRAPHS
17 | TYPE_NET_DIR = "webgraphs/"
18 |
19 |
20 |
21 |
22 | def main():
23 |
24 |
25 |
26 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
27 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
28 |
29 |
30 |
31 |
32 |
33 | if __name__ == '__main__':
34 | main()
35 |
--------------------------------------------------------------------------------
/src/make_normalization/wiki.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 | from helpers import constants, running
13 |
14 |
15 |
16 |
17 | # change here for type of net:
18 | NETWORK_FILES = constants.NETWORK_FILES_DIR_WIKI
19 | TYPE_NET_DIR = "wiki/"
20 |
21 |
22 |
23 | def main():
24 |
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/src/make_normalization/yeast.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 |
4 | __author__ = "Mari Wahl"
5 | __copyright__ = "Copyright 2014, The Cogent Project"
6 | __credits__ = ["Mari Wahl"]
7 | __license__ = "GPL"
8 | __version__ = "4.1"
9 | __maintainer__ = "Mari Wahl"
10 | __email__ = "marina.w4hl@gmail.com"
11 |
12 |
13 |
14 | from helpers import constants, running
15 |
16 | # change here for type of net:
17 | NETWORK_FILES= constants.NETWORK_FILES_UN_YEAST
18 | TYPE_NET_DIR = "yeast/"
19 |
20 |
21 |
22 |
23 |
24 | def main():
25 |
26 |
27 | running.sampling(NETWORK_FILES, TYPE_NET_DIR)
28 | print("All graphs for " + TYPE_NET_DIR + " were processed. The end! \n")
29 |
30 |
31 |
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------