print basic statistics about an edge, e.g. layer/attribute counts
9665
def edge_statistics(docgraph):
    """"""
    print "Edge statistics\n==============="
    layer_counts = Counter()
    attrib_counts = Counter()
    source_counts = Counter()
    target_counts = Counter()
    for source, target, edge_attrs in docgraph.edges_iter(data=True):
        for layer in edge_attrs['layers']:
            layer_counts[layer] += 1
        for attrib in edge_attrs:
            attrib_counts[attrib] += 1
        source_counts[source] += 1
        target_counts[target] += 1

    print "\nnumber of edges with layers"
    print_sorted_counter(layer_counts)
    print "\nnumber of edges with attributes"
    print_sorted_counter(attrib_counts)

    print "\nmost common source edges"
    print_most_common(source_counts)
    print "\nmost common target edges"
    print_most_common(target_counts)
679214
def edges(self):
        ""
        if util.config.future_deprecations:
            self.param.warning('Histogram.edges is deprecated in favor of '
                               'common dimension_values method.')
        return self.interface.coords(self, self.kdims[0], edges=True)
184821
def print_summary(self, w=0, objs=(), **print3opts):
        '''
        '''
        self._printf('%*d bytes%s%s', w, self._total, _SI(self._total), self._incl, **print3opts)
        if self._mask:
            self._printf('%*d byte aligned', w, self._mask + 1, **print3opts)
        self._printf('%*d byte sizeof(void*)', w, _sizeof_Cvoidp, **print3opts)
        n = len(objs or ())
        if n > 0:
            d = self._duplicate or ''
            if d:
                d = ', %d duplicate' % self._duplicate
            self._printf('%*d object%s given%s', w, n, _plural(n), d, **print3opts)
        t = _sum([1 for t in _values(self._seen) if t != 0])  # [] for Python 2.2
        self._printf('%*d object%s sized', w, t, _plural(t), **print3opts)
        if self._excl_d:
            t = _sum(_values(self._excl_d))
            self._printf('%*d object%s excluded', w, t, _plural(t), **print3opts)
        t = _sum(_values(self._seen))
        self._printf('%*d object%s seen', w, t, _plural(t), **print3opts)
        if self._missed > 0:
            self._printf('%*d object%s missed', w, self._missed, _plural(self._missed), **print3opts)
        if self._depth > 0:
            self._printf('%*d recursion depth', w, self._depth, **print3opts)
718505
public void printDualGraph() {
		System.out.println("============= Dual");
		int l = BoofMiscOps.numDigits(vertexes.size);
		String format = "%"+l+"d";

		for( Vertex n : vertexes.toList() ) {
			ChessboardCorner c = corners.get(n.index);
			System.out.printf("["+format+"] {%3.0f, %3.0f} ->  90[ ",n.index,c.x,c.y);
			for (int i = 0; i < n.perpendicular.size(); i++) {
				Edge e = n.perpendicular.get(i);
				System.out.printf(format+" ",e.dst.index);
			}
			System.out.println("]");
			System.out.print("                -> 180[ ");
			for (int i = 0; i < n.parallel.size(); i++) {
				Edge e = n.parallel.get(i);
				System.out.printf(format+" ",e.dst.index);
			}
			System.out.println("]");
		}
	}
735893
def printDot(self):
        """"""
        print("digraph ModuleDependencies {")
        print("  node[shape=box];")
        allNames = set()
        nameDict = {}
        for n, module in enumerate(self.listModules()):
            module._dot_name = "mod%d" % n
            nameDict[module.modname] = module._dot_name
            print("  %s[label=\"%s\"];" % (module._dot_name,
                                           quote(module.label)))
            allNames |= module.imports
        print("  node[style=dotted];")
        if self.external_dependencies:
            myNames = set(self.modules)
            extNames = list(allNames - myNames)
            extNames.sort()
            for n, name in enumerate(extNames):
                nameDict[name] = id = "extmod%d" % n
                print("  %s[label=\"%s\"];" % (id, name))
        for modname, module in sorted(self.modules.items()):
            for other in sorted(module.imports):
                if other in nameDict:
                    print("  %s -> %s;" % (nameDict[module.modname],
                                           nameDict[other]))
        print("}")
106685
def show_graph_summary(g):
    
    sample_data = []
    print("list(g[RDFS.Class]) = " + str(len(list(g[RDFS.Class]))))
    # Get Subject Lists
    num_subj = 0
    for subj in g.subjects(RDF.type):
        num_subj += 1
        if num_subj < 5:
            sample_data.append("subjects.subject: " + get_string_from_rdf(subj))
    print("g.subjects(RDF.type) = " + str(num_subj))
    
    # Get Sample of Subjects, Predicates, Objects
    num_subj = 0
    for subj, pred, obj in g:
        num_subj += 1
        if num_subj < 5:
            sample_data.append("g.subject   : " + get_string_from_rdf(pred))
            sample_data.append("g.predicate : " + get_string_from_rdf(subj))
            sample_data.append("g.object    : " + get_string_from_rdf(obj))
            
    print("g.obj(RDF.type) = " + str(num_subj))
    
    
    print ("------ Sample Data ------")
    for line in sample_data:
        print(line)
1340361
def _print_counts(self):
        
        print "#  ",
        for i in range(self.width):
            print "  %4d   "%i,
        print
        for L in ['A', 'C', 'T', 'G']:
            print "#%s "%L,
            for i in range(self.width):
                print  "%8.3f "%self.counts[i][L],
            print
824723
def print_stats(self):
        """"""
        funcname = self.fn.__name__
        filename = self.fn.__code__.co_filename
        lineno = self.fn.__code__.co_firstlineno
        print("")
        print("*** PROFILER RESULTS ***")
        print("%s (%s:%s)" % (funcname, filename, lineno))
        if self.skipped:
            skipped = "(%d calls not profiled)" % self.skipped
        else:
            skipped = ""
        print("function called %d times%s" % (self.ncalls, skipped))
        print("")
        stats = self.stats
        if self.filename:
            stats.dump_stats(self.filename)
        if not self.dirs:
            stats.strip_dirs()
        stats.sort_stats(*self.sort)
        stats.print_stats(self.entries)
116740
def _debugGraph(self):
        """"""
        print("Len of graph: ", len(self.rdflib_graph))
        for x, y, z in self.rdflib_graph:
            print(x, y, z)
909669
def print_graph(self, format=None, output=sys.stdout, depth=0, **kwargs):
        
        graph = self.as_graph(depth=depth)
        graph.print(format=format, output=output, **kwargs)
266779
def PrintStats(self):
    """"""
    self.BuildStats()
    self.PrintSummaryTable()
    self.PrintSourceTypeTable()
    self.PrintOSTable()
    self.PrintLabelTable()
602322
def describe_edge(self, edge):
        
        head, tail, data = self.edges[edge]
        return edge, data, head, tail
447254
def visualize(tree, max_level=100, node_width=10, left_padding=5):
    

    height = min(max_level, tree.height()-1)
    max_width = pow(2, height)

    per_level = 1
    in_level  = 0
    level     = 0

    for node in level_order(tree, include_all=True):

        if in_level == 0:
            print()
            print()
            print(' '*left_padding, end=' ')

        width = int(max_width*node_width/per_level)

        node_str = (str(node.data) if node else '').center(width)
        print(node_str, end=' ')

        in_level += 1

        if in_level == per_level:
            in_level   = 0
            per_level *= 2
            level     += 1

        if level > height:
            break

    print()
    print()
1334976
def outputs_of(self, idx, create=False):
        
        if create and not idx in self.edges:
            self.edges[idx] = set()
        return self.edges[idx]
1049039
def print_summary(self, heading: str) -> None:
        
        logger.info(heading)
        logger.info("Number of nodes: {}".format(len(self.graph.vs)))
        logger.info("Number of edges: {}".format(len(self.graph.es)))
1200277
def print_stat(x, message=None):
    
    if message is None:
        message = x.op.name
    lst = [tf.shape(x), tf.reduce_mean(x)]
    if x.dtype.is_floating:
        lst.append(rms(x))
    return tf.Print(x, lst + [x], summarize=20,
                    message=message, name='print_' + x.op.name)
1143356
def print_stats(self, stream=None):
        
        if not stream: # pragma: no cover
            stream = sys.stdout
        self.metadata.sort(key=lambda x: -x.size)
        stream.write('%-10s %8s %-12s %-46s\n' % ('id', 'size', 'type', 'representation'))
        for g in self.metadata:
            stream.write('0x%08x %8d %-12s %-46s\n' % (g.id, g.size, trunc(g.type, 12),
                trunc(g.str, 46)))
        stream.write('Garbage: %8d collected objects (%s in cycles): %12s\n' % \
            (self.count, self.num_in_cycles, pp(self.total_size)))