{"id":1390,"date":"2018-04-16T15:02:35","date_gmt":"2018-04-16T19:02:35","guid":{"rendered":"http:\/\/www.michelecoscia.com\/?page_id=1390"},"modified":"2018-07-23T07:57:11","modified_gmt":"2018-07-23T11:57:11","slug":"benchmark-for-network-sampling","status":"publish","type":"page","link":"https:\/\/www.michelecoscia.com\/?page_id=1390","title":{"rendered":"Benchmark for Network Sampling"},"content":{"rendered":"<h3 style=\"text-align: center;\"><strong>Benchmark for Network Sampling<\/strong><\/h3>\n<p style=\"text-align: center;\">implemented by me<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1391\" src=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/netsmpl.png\" alt=\"\" width=\"550\" height=\"282\" srcset=\"https:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/netsmpl.png 784w, https:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/netsmpl-300x154.png 300w, https:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/netsmpl-768x394.png 768w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/network_smpl_benchmark.zip\"><strong>Download ZIP File<\/strong><\/a><\/p>\n<p>This archive contains the code for performing network sampling benchmark. It is the companion material for my paper with <a href=\"https:\/\/pure.itu.dk\/portal\/en\/persons\/luca-rossi(1b45e3f5-b8cd-4c0d-a444-2901304f76ee).html\">Luca Rossi<\/a> &#8220;Benchmarking API Costs of Network Sampling Strategies&#8221;.<\/p>\n<p>The library depends on the igraph Python package. Make sure you install it first: http:\/\/igraph.org\/python\/<\/p>\n<p>To use the code, simply place the Python file into your working directory or in your path and import it. For instance, if you want to extract a directed sample using BFS exploration with a budget of 10000 seconds for an API giving 50 edges per page and one query every 5 seconds, this is the minimal code to do it:<\/p>\n<pre>import igraph\r\nimport network_sampling as ns\r\n\r\nG = igraph.Graph.Read_Edgelist(\"path\/to\/network\/file.ext\", directed = True)\r\napi_policy = ns.APIPolicy(edges_page_size = 50, seconds_per_call = 5)\r\napi_engine = ns.APIEngine(G, api_policy)\r\nG_smpl = ns.bfs(api_engine, seed = 0, budget = 10000, directed = True)\r\n<\/pre>\n<p>You can easily define new API policies in your code.<\/p>\n<p>The library is supposed to be extended. You can add new attributes to the API policy object (e.g. adding support for querying node attributes), and implement new network sampling methods. To be a valid sampling method, your function must:<\/p>\n<p>&#8211; Start the exploration from a given seed;<br \/>\n&#8211; End the exploration when no further move is possible given the budget;<br \/>\n&#8211; Use the request_neighbors function of the APIEngine object to explore the graph;<br \/>\n&#8211; Return the Graph sample as a directed igraph object if the &#8220;directed&#8221; flag was set to True.<\/p>\n<p>Sample networks containing the synthetic inputs used in the paper are available to test your methods are available <a href=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/sample_networks.zip\">here<\/a>.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2018\/04\/network_smpl_benchmark.zip\"><strong>Download ZIP File<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Benchmark for Network Sampling implemented by me Download ZIP File This archive contains the code for performing network sampling benchmark. It is the companion material for my paper with Luca Rossi &#8220;Benchmarking API Costs of Network Sampling Strategies&#8221;. The library depends on the igraph Python package. Make sure you install it first: http:\/\/igraph.org\/python\/ To use &hellip; <a href=\"https:\/\/www.michelecoscia.com\/?page_id=1390\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Benchmark for Network Sampling&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":25,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1390","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1390"}],"version-history":[{"count":2,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1390\/revisions"}],"predecessor-version":[{"id":1453,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1390\/revisions\/1453"}],"up":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/25"}],"wp:attachment":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}