Example #1
0
        def process_fcn(g):
            print "now processing"
            input_stats = geo_stats(g)
            geo_check_for_isolated(g)
            geo_filter_nones(g)
            geo_check_for_isolated(g)
            filtered_stats = geo_stats(g)
            node_map = geo_cluster(g, cities=[], restrict=False)
            #r = nx.DiGraph()
            g = geo_reduce(g, node_map)
            node_map = geo_cluster(g, cities=city_list, restrict=False)
            first_pass_stats = geo_stats(g)
            if self.options.filter_cities:
                g = geo_reduce(g, node_map)
                output_stats = geo_stats(g)
            elif self.options.geo_filter:
                print "Geo filtering..."
                g = geo_box_reduce(g, GEO_FILTERS[self.options.geo_filter])
                output_stats = geo_stats(g)

            print "input stats: \n" + input_stats
            print "filtered stats: \n" + filtered_stats
            print "first pass (no city filtering): \n" + first_pass_stats
            if self.options.filter_cities or self.options.geo_filter:
                print "output stats (after city filter): \n" + output_stats

            return g
Example #2
0
    def __init__(self, post_fcn = None):
        self.parse_args()
        options = self.options

        input = options.input
        # Input graph
        input_path = os.path.join(input, input + '.gpk')
        self.g = nx.read_gpickle(input_path)
        if not self.g:
            raise Exception("null input file for input path %s" % input_path)
        # Output (reduced) graph.
        # Nodes: (lat, long) tuples w/ list of associated users & location strings
        # Edges: weight: number of links in this direction
        self.r = nx.DiGraph()

        conn = Connection()
        self.input_db = conn[self.options.input_db]
        self.input_coll = self.input_db[self.options.input_coll]

        print "now processing"
        self.reduce()
        print geo_stats(self.r)

        if options.write:
            geo_path = os.path.join(input, input + '.grg')
            nx.write_gpickle(self.r, geo_path)
Example #3
0
        def process_fcn(g):
            print "now processing"
            input_stats = geo_stats(g)
            geo_check_for_isolated(g)
            geo_filter_nones(g)
            geo_check_for_isolated(g)
            filtered_stats = geo_stats(g)
            node_map = geo_cluster(g, cities = [], restrict = False)
            #r = nx.DiGraph()
            g = geo_reduce(g, node_map)
            node_map = geo_cluster(g, cities = city_list, restrict = False)
            first_pass_stats = geo_stats(g)
            if self.options.filter_cities:
                g = geo_reduce(g, node_map)
                output_stats = geo_stats(g)
            elif self.options.geo_filter:
                print "Geo filtering..."
                g = geo_box_reduce(g, GEO_FILTERS[self.options.geo_filter])
                output_stats = geo_stats(g)

            print "input stats: \n" + input_stats
            print "filtered stats: \n" + filtered_stats
            print "first pass (no city filtering): \n"+ first_pass_stats
            if self.options.filter_cities or self.options.geo_filter:
                print "output stats (after city filter): \n" + output_stats

            return g
Example #4
0
    def __init__(self, post_fcn=None):
        self.parse_args()
        options = self.options

        input = options.input
        # Input graph
        input_path = os.path.join(input, input + '.gpk')
        self.g = nx.read_gpickle(input_path)
        if not self.g:
            raise Exception("null input file for input path %s" % input_path)
        # Output (reduced) graph.
        # Nodes: (lat, long) tuples w/ list of associated users & location strings
        # Edges: weight: number of links in this direction
        self.r = nx.DiGraph()

        conn = Connection()
        self.input_db = conn[self.options.input_db]
        self.input_coll = self.input_db[self.options.input_coll]

        print "now processing"
        self.reduce()
        print geo_stats(self.r)

        if options.write:
            geo_path = os.path.join(input, input + '.grg')
            nx.write_gpickle(self.r, geo_path)